0

Angular is giving me the following errors even though I have FormsModule imported.

Error: src/app/user/user.component.html:9:26 - error NG8003: No directive found with exportAs 
'ngForm'.

<form #signinForm="ngForm">

                      
Error: src/app/user/user.component.html:25:48 - error NG8002: Can't bind to 'ngModel' since it 
isn't a known property of 'input'.

title="Password" name="password" [(ngModel)]="user.password" #password="ngModel" 
name='password' required>

I have FormsModule imported in user.module.ts:

@NgModule({
  imports: [
    FormsModule
  ]
})
export class UserModule { }

I also tried importing it in app.modules to no avail.

koque
  • 1,830
  • 5
  • 28
  • 49
  • Maybe related: https://stackoverflow.com/questions/38892771/cant-bind-to-ngmodel-since-it-isnt-a-known-property-of-input – iLuvLogix Dec 27 '21 at 15:46
  • @Deepak I have used that syntax in numerous applications. I believed I got it from angular.io. – koque Dec 27 '21 at 15:49
  • This is from angular.io hero application:
    – koque Dec 27 '21 at 16:00
  • has you re-init the `ng serve`? it's looks like fine. BTW check if you has a variable in your .ts with the same name. I don't know what more can be happened :(. NOTE @DeepakJha, yes, it's used in template driven forms -forms that use [(ngModel)]- – Eliseo Dec 27 '21 at 17:19
  • Yeah, Eliseo, I am actually using ng build so I have rebuilt many times but the problem still exists. – koque Dec 27 '21 at 18:31

0 Answers0