dimanche 2 février 2020

Angular : When ngModel data is updated from component, UI changes are not changing model value

In an table i have used a checkbox, At any point of time user can select only 2 checkbox. so whenever user selects checkbox i call a function and check if more than 2 checkbox is select, if yes i wil show an error message and change the third checkbox to unchecked state.

After changing checkbox value to unchecked, if i change the checkbox to checked state again from UI, model is not updating

<input _ngcontent-c9="" type="checkbox" class="ng-valid ng-dirty ng-touched" **ng-reflect-model="false"**>

ng-reflect-model="false" this value is not becoming true again.

 <input type="checkbox" [(ngModel)]="item.blink" (change)="toggleBlink(item)">

How to do this ?




Aucun commentaire:

Enregistrer un commentaire