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

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

    This is for the folks who use plain JavaScript instead of Type Script. In addition to referencing the forms script file on top of the page like below

    
    

    you should also tell the the module loader to load the ng.forms.FormsModule. After making the changes my imports property of NgModule method looked like below

    imports: [ng.platformBrowser.BrowserModule, ng.forms.FormsModule],

    Happy coding!

提交回复
热议问题