I have been following this solution
How to get selected only single checkbox from multiple checkboxes using ionic 2 and angular2 its working fine but the issue is
When i check any checkbox the other gets disabled (which is what i want) but if i uncheck the same checkbox the other still remains disabled. How do i enable them after the checkbox is unchecked?
here is my code .ts file
export class list {
checkedIdx = -1;
}
.html file
<ion-card class="ion-card">
<ion-item *ngFor="let item of options; let i=index">
<ion-label></ion-label>
<ion-checkbox item-left [ngModel]="checkedIdx == i"(ngModelChange)="$event ? checkedIdx = i : checkedIdx = -1" [disabled]="checkedIdx >= 0 && checkedIdx != i"></ion-checkbox>
</ion-item>
</ion-card>
Aucun commentaire:
Enregistrer un commentaire