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

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

Solution:

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

[...]

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

Explaination:

In order to be able to use two-way data binding for form inputs you need to import the FormsModule package in your Angular module.

For more information, see the Angular 2 official documentation here and the official documentation for forms.


Can't bind since it isn't a known property?

This error often means that you haven't declared the directive "x" or haven't imported the NgModule to which "x" belongs.

πŸ”₯ 81 Views
Mar 18, 2022