vendredi 4 mai 2018

How to access multiple checkbox values in Angular 4/5

I want to get the values from my checkboxes but I can only get true or false.

Here is my template:

<h4>Categories</h4>
<div class="form-check" *ngFor="let cat of categories$|async">
    <input class="form-check-input" [(ngModel)]="cat.id" name="" type="checkbox" id="">
    <label class="form-check-label" for="">
        
    </label>
</div>

Here is my component

this.categories$ = this.storeService.getAllCategories().pipe(
    map(result => (result as any).data),
    tap(r => console.log(r))
)

My component basically gets a list of the categories from an external api

enter image description here




Aucun commentaire:

Enregistrer un commentaire