Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Ionic 3 using ion-checkbox for only select one

$
0
0

@Nulra wrote:

How can I using checkbox for select one (just like radio), my code:

<div *ngFor="let address of addresses; let i = index;">
    <ion-item>
    <ion-checkbox id="cb_{{address.id}}" (ionChange)="selectedAddress(address.id,addresses,i)" checked="false"></ion-checkbox>
    </ion-item>
</div>

in ts file:

selectedAddress(id,addresses,index){
  for(let i=0; i<addresses.length; i++){
    if(index != i){
      document.getElementById("cb_"+addresses[i].id).checked = false;
    }
  }
}

but it is not working, anyone know how to achieve it? thanks a lot

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>