ERROR in src/app/login/login.component.html:11:49 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'. code example

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

import { FormsModule } from '@angular/forms';

[...]

@NgModule({
  imports: [
    [...]
    FormsModule
  ],
  [...]
})

Example 2: Uncaught Error: Template parse errors: Can't bind to 'ngModel'

Try to import FormModule an app.module.ts file

import { FormsModule } from '@angular/forms'

@NgModule({
  declarations: [
    ....
  ],
  imports: [
    ...,
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Tags:

Misc Example