lundi 14 janvier 2019

How to get all checked cheboxes from dynamic list

I have a dynamic list of checboxes and I want to send only the checked to my request... But I don't know how to do that...

Here is my list of checkboxes

  <div *ngFor="let p of places;  let i=index">
                            <mat-checkbox class="example-margin secondary-text"
                                          [checked]="checkValue(p, i)" id="">
                               places</mat-checkbox>
                        </div>

Here is the checkvalue method. The placesList is the default and I use to check the checkboxes by default.

checkValue(item: any, index: any) {

    return this.placesList.some(e => e === item);
}




Aucun commentaire:

Enregistrer un commentaire