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

前端 未结 30 1411
予麋鹿
予麋鹿 2020-11-22 12:44

I\'ve got the following error when launching my Angular app, even if the component is not displayed.

I have to comment out the so that my

30条回答
  •  执念已碎
    2020-11-22 13:05

    ngModel is the part of FormsModule. And it should be imported from @angular/forms to work with ngModel.

    Please change the app.module.ts as follow:

    import { FormsModule } from '@angular/forms';
    
    [...]
    
    @NgModule({
      imports: [
        [...]
        FormsModule
      ],
      [...]
    })
    

提交回复
热议问题