How to Clear Can’t bind to ‘ngModel’ since it isn’t a known property of ‘mat-select’ in angular.

The full error looks like:

Can’t bind to ‘ngModel’ since it isn’t a known property of ‘mat-select’.
 1. If ‘mat-select’ is an Angular component and it has ‘ngModel’ input, then verify that it is part of this module.
 2. If ‘mat-select’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
 3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component.

Error : can’t bind to ngModel since it isn’t known property of Mat-select

   

This error occurs in app.module.ts because we forgot to add schema to the directive.

You can add schema at every component or you can add schema to app.module.ts.

We use different schemas to build an app like HTML and angular material. So angular CLI needs to understand whether different schemas are used or not?

So we just say we use different schemas to the angular. So angular get Understood and compile and build as per the requirement.

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@NgModule({
  declarations: [
    AppComponent,
    ...
 
  ],
  imports: [
    BrowserModule,
    ...
  ],
  
  bootstrap: [AppComponent],
  schemas: [
    CUSTOM_ELEMENTS_SCHEMA 
],
})
export class AppModule { }

   That’s it. You just run your application and hope this will be helpful. If you have any queries below in the comments are welcome.

Have a great day!.

   

Leave a Reply

Your email address will not be published. Required fields are marked *