I am working with an array of booleans representing week days to determine which day is selected:
selectedWeekDays: boolean[] = [true,true,true,true,true,true];
In my HTML file:
<section>
<h4>Choose your days:</h4>
<mat-checkbox [(ngModel)]="selectedWeekDays[0]">Saturday</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[1]">Sunday</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[2]">Monday</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[3]">Tuesday</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[4]">Wednesday</mat-checkbox>
<mat-checkbox [(ngModel)]="selectedWeekDays[5]">Thursday</mat-checkbox>
</section>
However, I am encountering the following errors for each mat-checkbox: Type 'Event' is not assignable to type 'boolean'. <mat-checkbox [(ngModel)]="selectedWeekDays[2]">Saturday ... and so on... and also this error: Can't bind to 'ngModel' since it isn't a known property of 'mat-checkbox'.
Unfortunately, I am facing similar issues with radio buttons. Why are these errors occurring and how can I resolve them? Thank you in advance.