I'm trying to set default value as checked on a checkbox inside my ngFor. This is my array of checkbox items:
tags = [{
name: 'Empathetic',
checked: false
}, {
name: 'Smart money',
checked: true
}, {
name: 'Minimal help after writing check',
checked: false
}, {
name: 'Easy term sheet',
checked: true
}];
This is my html
<div class="form-group">
<div class="form-check" *ngFor="let tag of tags;">
<label class="form-check-label" for="tag{{tag.value}}">
<input
class="form-check-input"
type="checkbox"
id="tag{{tag.value}}"
name="tagOptions"
[(ngModel)]="tag.checked">
{{tag.name}}
</label>
</div>
</div>
The desired result is to get 2 checked, and 2 unchecked boxes, but all of them are unchecked. I've also tried different variations with [checked]="tag.checked", but it didn't seem to do the trick.