Posts

Showing posts with the label anguarjs-digest-cycle

Angular checked function is ignored because of ngModel

Image
Clash Royale CLAN TAG #URR8PPP Angular checked function is ignored because of ngModel Im new at Angular. Im trying to create a checkbox table which compared with another table and will checked it if it existed. this function works great, but when im adding ngModel - in order to save the changes, the checked function somehow ignored when first loading the page. <tbody> <tr *ngFor="let w of workout;let i = index"> <td> <div class="col-md-6"> <input type="checkbox" name="workout_{{i}}" [checked]="checkIfExisted(w)" [value]="w" [(ngModel)]="program.workouts[i]"> </div> </td> <td> <div class="col-md-6">{{w.workoutName}}</div> </td> </tr> </tbody> My function: checkIfExisted(w:WORKOUT){ if(!this.p...