Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda