I want to implement a checklist in angular. Some boxes have to be pre-checked based on an array in the ts file and the array has to be updated when a checkbox in checked: I am doing it like :
<div class='form-group que-box' *ngFor="let option of currentQuestion.options">
<input type="checkbox" aria-label="Checkbox 1" [value]="option.text" name="checkBox" [(ngModel)]="optionsSelectedArray"/>
<label for=''><span class="que"></span></label>
</div>
optionsSelectedArray
contains the option Ids retrieved from server.
But it doesn't work.All the checkboxes come checked when the the division is rendered.
Aucun commentaire:
Enregistrer un commentaire