简体   繁体   中英

“Can't bind to 'ngModel' since it isn't a known property of 'input' ”

My project was completely running fine but I don't how, when, Where What happened that it's giving error

Can't bind to 'ngModel' since it isn't a known property of 'input'

and also

  1. If 'mat-error' is an Angular component, then verify that it is part of this module.
  2. If 'mat-error' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

在此处输入图像描述 I have already imported FormsModule and it wasn't giving error before but I don't why it suddenly started giving this error.

在此处输入图像描述 Also include into imports array

在此处输入图像描述Error showing. I have already inserted the angular material as well as all the necessary imports

在此处输入图像描述Also included FormsModule in app.component.spec.ts

Looks like you have lazy loaded modules, for them you need to import FormsModule in the related module, not in the app.module . try to import them in EventRegiterModule .

If it's Angular 2+ you should use [ngModel]="Email_id" (ngModelChange)="Email_id = $event" instead of [(ngModel)]="Email_id"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM