如果我单击项目我需要添加类名称,如果单击相同的项目需要删除ngFor循环的类
<ion-item *ngFor="let x of statementresponse;let i=index" class="cust_delay delay" [ngClass]="{'active': selectedItem == x}" (click)="listClick($event, x)" >
</ion-item>
selectedItem:any;
listClick(event, newValue) {
console.log(newValue);
this.selectedItem = !newValue;.
}
Run Code Online (Sandbox Code Playgroud) 离子滑块在最后一张幻灯片中隐藏下一个按钮并在第一张幻灯片中隐藏上一个按钮尝试使用 ngIf 实现此功能,但它不起作用 ionic 4
<ion-slides #slides>
(...)
</ion-slides>
<button ion-button *ngIf="slides.isBeginning()">prev</button>
<button ion-button *ngIf="slides.isEnd()">Next</button>
Run Code Online (Sandbox Code Playgroud) 我在 ionic 2 项目中工作,创建滑动以删除每个工作正常的项目,还需要单击按钮删除所有项目如何从 angular 2 的列表中删除所有项目?
<button ion-button clear>Clear All</button>
<ion-item-sliding *ngFor="let note of notes">
<ion-item>
{{note.title}}
</ion-item>
<ion-item-options>
<button (click)="deleteNote(note)" danger>
<ion-icon name="trash"></ion-icon>
</button>
</ion-item-options>
</ion-item-sliding>
Run Code Online (Sandbox Code Playgroud)
文件.ts
constructor( public viewCtrl: ViewController ) {
this.notes = [
{ title: 'This is notification swipe to delete' },
{ title: 'This is notification swipe to delete' }
];
}
deleteNote(note){
let index = this.notes.indexOf(note);
if(index > -1){
this.notes.splice(index, 1);
}
}
Run Code Online (Sandbox Code Playgroud) 我已经使用ionic 4开发了该应用,并创建了新的标签应用,并构建了android apk文件,其大小变得太大了。
应用大小为6177kB
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.0.0",
"cordova-android": "7.1.4",
Run Code Online (Sandbox Code Playgroud)