幻灯片我有这样的HTML
<ion-slides [pager]="false" slidesPerView="6" #slider_a>
<ion-slide *ngFor="let slide of items_a " #ddd>
<ion-card class="list-card" >
<div class="cardInnerWrap">
<ion-item>
{{slide.gameTitle}}
</ion-item>
<img src="{{slide.gameImage}}">
</div>
</ion-card>
</ion-slide>
</ion-slides>
<ion-slides [pager]="false" slidesPerView="6" #slider_b>
<ion-slide *ngFor="let slide of items_b " #ddd>
<ion-card class="list-card" >
<div class="cardInnerWrap">
<ion-item>
{{slide.gameTitle}}
</ion-item>
<img src="{{slide.gameImage}}">
</div>
</ion-card>
</ion-slide>
</ion-slides>
Run Code Online (Sandbox Code Playgroud)
它在移动设备上工作.问题是当我在Firefox中拖动幻灯片2时(也在Chrome中),幻灯片1也被拖动了.不能单独拖动幻灯片2.如何在离子2中制作2个完全独立的滑块,可在浏览器中使用
我正在尝试使用fastlane在Jenkins中自动构建/部署我的hybdrid移动应用程序.我使用ionic(v3.3.0)和cordova(v7.0.1)作为来源.我使用fastlane v2.36.0,Xcode是版本8.3.2.
我在jenkins工作中运行的命令
yarn
ionic cordova prepare
fastlane ios build
Run Code Online (Sandbox Code Playgroud)
fastlane/FastFile
platform :ios do
before_all do
end
ios_project_path = "platforms/ios/awesomeproject.xcodeproj"
desc "Build for IOS"
lane :build do
increment_build_number(
xcodeproj: ios_project_path,
build_number: ENV["BUILD_NUMBER"]
)
# Recreate schemes to ensure a smooth transition from cordova to gym
recreate_schemes(project: ios_project_path)
update_project_team(
path: ios_project_path,
teamid: "TEAMID"
)
#update_provisioning_profile_specifier(xcodeproj: ios_project_path)
gym(scheme: "awesomeproject",
configuration: "Debug",
clean: true,
project: ios_project_path,
output_directory: "target")
end
end
Run Code Online (Sandbox Code Playgroud)
fastlane/Appfile
package_name "com.xxx.awesomeapp"
app_identifier "com.xxx.awesomeapp" # The bundle identifier of your app
apple_id …Run Code Online (Sandbox Code Playgroud) 这是我的模板:
<label>{{label}}</label>
<input type="file" (change)="fileUpload($event)" id="file-input" style="position:absolute; top: -999999px" #fileInp>
<button ion-button (click)="onClick()">Upload</button>
Run Code Online (Sandbox Code Playgroud)
和ts文件:
@ViewChild('fileInp') fileInput: ElementRef;
@Input() label: string;
@Output() data = new EventEmitter<FormData>();
fileUpload(event) {
let fd = new FormData();
fd.append('file', event.srcElement.files[0]);
this.data.emit(fd);
}
onClick() {
this.fileInput.nativeElement.click();
}
Run Code Online (Sandbox Code Playgroud)
在Android和浏览器中一切正常,但在iOS上则不行.如果我禁用模板中的按钮,相同的代码将起作用.
我要将多个图像上传到服务器.
这是DataURL的数组.
items: {
img_url : string
}[] = [];
Run Code Online (Sandbox Code Playgroud)
我发现离子原生文件传输只能上传一个文件.
我如何上传多个文件?
嘿家伙我想知道如何在'.ts'文件中翻译文本
基本上它是一个加载文本
showLoader() {
this.loading = this.loadingCtrl.create({
content: 'Loading...'
});
this.loading.present();
}
Run Code Online (Sandbox Code Playgroud)
我需要的是将文本"Loading ..."翻译为"Chargement ..."当语言设置为法语
感谢时
我尝试在我的Ionic App中覆盖手机的后退按钮.
如果我不在页面中,此代码允许我打开模式以关闭应用程序,否则关闭页面.
但这不允许我关闭一个打开的模态.如何检测我是否处于模态中以关闭它?
platform.registerBackButtonAction(() => {
let nav = app.getActiveNav();
let activeView: ViewController = nav.getActive();
console.log(activeView);
if(activeView != null){
if(nav.canGoBack()) {
activeView.dismiss();
} else{
let alert = this.alertCtrl.create({
title: this.pdataManager.translate.get("close-app"),
message: this.pdataManager.translate.get("sure-want-leave"),
buttons: [
{
text: this.pdataManager.translate.get("no"),
handler: () => {
this.presentedAlert = false;
},
role: 'cancel',
},
{
text: this.pdataManager.translate.get("yes"),
handler: () => {
this.presentedAlert = false;
this.platform.exitApp();
}
}
]
});
if(!this.presentedAlert) {
alert.present();
this.presentedAlert = true;
}
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
我想在蓝牙连接完成后执行一些操作,反之亦然.
处理连接的方案,并添加成功和失败处理程序,并在这些处理程序函数中将标志更改为True和False.
我使用console.log打印了该值,它在组件文件中更改但未反映在HTML中.
我尝试过使用ngZone,但它没有用.
成功和失败处理代码如下:
BluetoothService
import { Injectable } from "@angular/core";
import { BLE } from '@ionic-native/ble';
@Injectable()
export class BlueToothService {
constructor(private ble: BLE){
}
public connect = (deviceId, onConnect, onFailure) => {
this.ble.isConnected(deviceId)
.then(response => {
onConnect(response);
},
error => {
this.ble.connect(deviceId)
.subscribe(response => {
onConnect(response);
},
error => {
onFailure(error);
});
});
} }
Run Code Online (Sandbox Code Playgroud)
组件文件
import {Component, NgZone} from '@angular/core';
import {Events, IonicPage, NavController, NavParams, ViewController} from 'ionic-angular';
import {BlueToothService} …Run Code Online (Sandbox Code Playgroud) 我正在开发一个名为portal的离子3项目.我需要创建一个名为user的服务,但我不断收到上述错误.这些是我遵循的步骤:
cd portal
npm install -g angular-cli@latest
npm install
ng g service user
Run Code Online (Sandbox Code Playgroud)
然后我得到错误此命令只能在CLI项目中运行.我注意到angular-cli没有被添加到package.json中的依赖列表中,也没有在节点模块目录下的@angular下的cli目录.我尝试了两次安装angular-cli,但错误仍然存在.已经坚持了很长一段时间任何帮助真的很感激.
我正在使用一个 ion-select,我正在启用该multiple属性来选择几个选项.如果已经检查了3个选项,我找不到实时禁用其余选项的方法.我目前正在使用该ionSelect事件,但它仅在选中选项时有效.我怎样才能解决我的问题?我怎样才能解决我的问题?我想知道我是如何知道我已经标记了多少选项并实时获得它们的价值.
这是我的代码:https: //stackblitz.com/edit/ionic-8wewvd?file = pages/home/home.ts
页/家
<ion-label>Select a person</ion-label>
<ion-select [(ngModel)]="person" multiple="true">
<ion-option *ngFor="let item of options; let i = index"
[value]="item.id" (ionSelect)="fn_checkOptions()" >
{{item.name}}
</ion-option>
</ion-select>
export class HomePage {
public options:object=[];
constructor(public navCtrl: NavController) {
this.options=
[
{"name":"pedro","id":1},
{"name":"juan","id":2},
{"name":"maria","id":3},
{"name":"velez","id":4},
{"name":"yaya","id":4}
]
}
fn_checkOptions(){
alert("hey")
}
}
Run Code Online (Sandbox Code Playgroud) 昨天,我在我的Android设备上构建并运行了我的应用程序,这个版本运行正常.
从那以后,我改进了我的应用程序(内容视图和某些模块的控制器),今天,我在设备上有黑屏.
ionic serveionic cordova run android --debug我想也许我的构建配置已损坏,但我不知道如何.
我试过了:
但这些步骤没有解决问题.
在设备上,我无法访问Chrome的"Inspect device"工具,看看我是否有JS问题.
你有什么想法解决我的问题吗?
经过更多测试,我发现了以下行为:
如果我更改了
<widget id="new-app-id">in 的IDconfig.xml,app在设备上运行正常!
对这种行为有什么想法吗?
谢谢!