I would use the check / uncheck all checkbox control to receive notifications when the user checks or cancels:
<input type="checkbox" [ngFormControl]="allCtrl"/>
allCtrl initialized inside the component constructor. You can then register with the valueChanges property of this control to receive update notifications and update the isChecked fields accordingly:
constructor() { this.allCtrl = new Control(); this.allCtrl.valueChanges.subscribe( (val) => { this.projectdata.LoginResponse.ProjectVM.forEach((project) => { project.isChecked = val; }); }); }
source share