Angular: Can't bind to 'ngModel' since it isn't a known property of 'input'问题解决

https://blog.csdn.net/h363659487/article/details/78619225


最初使用

[(ngModel)]

做双向绑定时,如果遇见Angular: Can't bind to 'ngModel' since it isn't a known property of 'input'问题

解决办法:

在你的app.module中添加如下代码即可:

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

 

@NgModule({
    imports: [
         FormsModule   //此代码仅为需加入的部分,注意比对你本身的代码,把这个加入其中即可   
    ]

posted on 2018-04-15 23:11  童彪  阅读(287)  评论(0编辑  收藏  举报

导航