vendredi 17 février 2017

how to create checkbox dynamically and get the value of all selected checkbox in angular 2

This is my html. I want to get the value of all selected checkbox when any checkbox is checked or unchecked i.e (change) event fired

<div class="checkbox checkbox-primary" *ngFor="let category of categories; let i = index"> <input type="checkbox" id="checkbox_category" (change)="search(category, $event)" /> </div>

This is my search method in angular 2 component :

selectedItems: any = [];
search( category, event) {

   // set selectedItems here
}




Aucun commentaire:

Enregistrer un commentaire