jeudi 20 février 2020

Ion checkbox binding two values

I have been struggling with ion-checkboxes and I really need some help. I am developing a questionnaire that has true or false answers. I want the true and false to appear as ion-checkboxes. Something like this

 <ion-row>
 <ion-col size="1">
  <ion-checkbox [checked]="option1" (ionChange)=change1()>
  </ion-checkbox>
 </ion-col>
 <ion-col>True </ion-col>
 <ion-col size="1">
  <ion-checkbox [checked]="option2" (ionChange)=change1()>
  </ion-checkbox>
 </ion-col>
 <ion-col>False </ion-col>
</ion-row>

I want the ionChange to ensure that only one checkbox is checked as true at a time. In other worlds, if the user selects true, then the false checkbox (option2) will automatically become false. If anyone can help I would really appreciate it.




Aucun commentaire:

Enregistrer un commentaire