I'm using Angular 4 and I am getting an error in the console:
Can't bind to 'ngModel' since it isn't a known property of 'input'
How can I resolve this?
I'm using Angular 4 and I am getting an error in the console:
Can't bind to 'ngModel' since it isn't a known property of 'input'
How can I resolve this?
I ran into this error when testing my Angular 6 App with Karma/Jasmine. I had already imported
FormsModule
in my top-level module. But when I added a new component that used[(ngModel)]
my tests began failing. In this case, I needed to importFormsModule
in myTestBed
TestingModule
.In
app.module.ts
add this:Your
ngModel
is not working because it's not a part of yourNgModule
yet.You have to tell the
NgModule
that you have authority to usengModel
throughout your app, You can do it by addingFormsModule
into yourapp.module.ts
->imports
->[]
.This is a right answer. you need to import FormsMoudle
first in app.module.ts
**
** second in app.component.spec.ts
Best regards and hope will be helpfull
Try adding
The code is same as the above