Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
why NgModel does not work for mat-checkbox, radio buttons in angular?

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!