我想要 ion-select 提供选择选项 . 我在第一个位置手动添加了选择所有选项,当我选择所有视图未更新时 . 如何更新视图?
.html
<ion-select multiple="true">
<ion-option (ionSelect)="allClicked()">select all</ion-option>
<ion-option *ngFor="let item of students ; let i = index" [selected]="item.checked" [value]="item">{{item.studentName}}</ion-option>
</ion-select>
.ts
allClicked(){
if(this.isAll){
console.log(this.isAll)
this.isAll = false;
for (let temp of this.students) {
temp.checked = false;
}
}else{
this.isAll = true;
for (let temp of this.students) {
temp.checked = true;
}
}
console.log("all select event ");
}
1 回答
一个解决方案是将所有学生都放在模型中进行离子选择
ts.
我假设学生是一群学生 .