need your help
I have an array of checkbox values
colors = ['Black', 'Red', 'White', 'Blue', 'Yellow', 'Grey'];
Implemented them in HTML
<div *ngFor="let color of colors; let i = index" class="checkbox">
<label>
<input type="checkbox" class="colors" [value]="color" (change)="addCheckboxData($event)" />
</label>
</div>
I have an array of values that should be checked when I load the page
checkedValues = ['Black', 'White', 'Grey'];
I added them to formarray
color: this._formBuilder.array(this.checkedValues),
It works and color formarray have values like in checkedValues array:
But checkboxes are not checked so I want this values to be displayed as checked. How can I do this? Thank You
Aucun commentaire:
Enregistrer un commentaire