I know it may be repeated answer but for any one want to load list of checkboxes with selectall checkbox into angular form i follow this example: Select all/deselect all checkbox using angular 2+
it work fine but just need to add
[ngModelOptions]="{standalone: true}"
the final HTML should be like this:
<ul>
<li><input type="checkbox" [(ngModel)]="selectedAll" (change)="selectAll();"/></li>
<li *ngFor="let n of names">
<input type="checkbox" [(ngModel)]="n.selected" (change)="checkIfAllSelected();">{{n.name}}
</li>
</ul>
TypeScript
selectAll() {
for (var i = 0; i < this.names.length; i++) {
this.names[i].selected = this.selectedAll;
}
}
checkIfAllSelected() {
this.selectedAll = this.names.every(function(item:any) {
return item.selected == true;
})
}
hope this help thnx