Angular---can't bind to 'ngModel' since it isn't a know property of 'input'

Angular2在双向数据绑定时,抛出如下问题:

can't bind to 'ngModel' since it isn't a know property of 'input'


解决办法:

在app.module.ts文件中,

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

向其应用模块@NgModule({})的imports:[]添加

FormsModule
具体如图所示:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章