I’m using an ion-select and I’m enabling the multiple attribute to select several options. I can not find a way to disable the rest of the options in real time if 3 options have already been checked. I am currently using the ionSelect event, but it only works when an option is checked. How can I solve my problem? How can I solve my problem? I would like to understand how I know how many options I have marked and get their value in real time.
this is my code: https://stackblitz.com/edit/ionic-8wewvd?file=pages/home/home.ts
pages/home
<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")
}
}