lundi 22 octobre 2018

How to check and uncheck checkbox using change method

I want to trigger an event only when the check box is tick and then it will remove the event when the check box is unchecked. How do I do this?Currently I'm using (change) to trigger an event but this will be triggered if I check or unchecked the box.

 public send(line : any){
    this.broadCastService.sendLine(line);
  }
<div *ngFor="let line of test  ">
  <label>
    
    <input type="checkbox" ng-model="line" (change)="send(line)">
  </label>



Aucun commentaire:

Enregistrer un commentaire