I have an array of boolean for week days to check what day is selected: selectedWeekDays: boolean[] = [true,true,true,true,true,true];
and in .html:
<section>
<h4>select your days:</h4>
<mat-checkbox [(ngModel)]="selectedWeekDays[0]">sat</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[1]">sun</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[2]">mon</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[3]">tue</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[4]">wed</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[5]">thu</mat-checkbox>
</section>
but this error is raised for each mat-checkbox: Type 'Event' is not assignable to type 'boolean'. <mat-checkbox [(ngModel)]="selectedWeekDays[2]">sat ... and so on... and also this error: Can't bind to 'ngModel' since it isn't a known property of 'mat-checkbox'.
unfortunately, similar above error I had for radio buttons. why this error is raised and how can fix it? best regards
Make sure you have imported FormsModule in your AppModule.
Can't bind to 'ngModel' since it isn't a known property of 'mat-checkbox'. This error is due to missing FormModule.