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

前端 未结 30 1405
予麋鹿
予麋鹿 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:02

    If you need to use [(ngModel)] first do you need to import FormsModule in app.module.ts and then add in a list of imports. Something like this:

    app.module.ts

    1. import import {FormsModule} from "@angular/forms";
    2. add in imports imports: [ BrowserModule, FormsModule ],

    app.component.ts

    1. Example:
    2. and then

      your name is: {{name}}

提交回复
热议问题