Change only one checkbox

0

How do I change just the checkbox I'm clicking?

checked:boolean=false;
ck() {
    if(this.checked === false){
      this.checked=true;
    }else{
      this.checked=false;
    }
<ion-item>
  <ion-label  class="title" [class.title-service-check]="checked">item 01 <span class="box-service-price">R$ 80,00</span></ion-label>
  <ion-checkbox color="green" (click)="ck()"></ion-checkbox>      
</ion-item>
<ion-item>
  <ion-label class="title" [class.title-service-check]="checked">item 02 <span>R$ 80,00</span></ion-label>        
  <ion-checkbox color="green" (click)="ck()"></ion-checkbox>
</ion-item>
    
asked by anonymous 03.03.2018 / 15:47

1 answer

1

You need a checked variable with another clear name for each checkbox. You also do not need a function for this logic. You can do this:

<ion-checkbox color="green" (click)="checked=!checked"></ion-checkbox>
    
13.03.2018 / 16:37