jeudi 25 octobre 2018

Angular 5 checkbox checked default but its not triggering the change event [duplicate]

This question already has an answer here:

I have a list of checkboxes and some checkboxes or default checked, when if it's checked I would like to call the change event but it's not working as expected. The code as below

 <tr *ngFor="let permission of permissions[key]; let i = index">
<td></td>
<td>
    <span class="m-switch m-switch--primary">
        <label>
            <input type="checkbox" 
                 name="check-box-"
                 [value]="permission.id" 
                 [checked]="isChecked(permission.id)"
                 (change)="updatePermission($event,permission, key)"
                 attr.id="check-box-">
            <span></span>
        </label>
    </span>
</td>

 public updatePermission(event: any, permission: any, key: any){
        console.log(event);
    }

Anyone please help




Aucun commentaire:

Enregistrer un commentaire