dimanche 13 novembre 2022

ngFor checkbox generation binding same value for all checkboxes

My goal is to save 1 for the checkbox which is selected and 0 for all that aren't.

With the code I have, it will always save 1 (whether selected or not) for all checkboxes and this is not the desired outcome

I'm using NG-ZORRO for the checkbox but I get the same result with a regular checkbox type input

<div *ngFor="let ims of mIntake.TblIntakeStaff" style="display: flex; margin-bottom: 4px">
          <div style="flex-grow: 1; flex-basis: 0"> </div>
            <div style="flex-grow: 1; flex-basis: 0">   
                <label nz-checkbox            
                    [ngModel]="ims.Percentage * 0"
                    (ngModelChange)="ims.Percentage = 1" >              
                </label>                                          
            </div>
          </div>



Aucun commentaire:

Enregistrer un commentaire