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具体如图所示:
本文解决了Angular2中出现的“can't bind to 'ngModel' since it isn't a known property of 'input'”错误。该问题通常发生在尝试使用双向数据绑定时。解决方案是在app.module.ts文件中引入FormsModule,并将其添加到@NgModule的imports数组中。
Angular2在双向数据绑定时,抛出如下问题:
can't bind to 'ngModel' since it isn't a know property of 'input'
解决办法:
在app.module.ts文件中,
import { FormsModule } from '@angular/forms';FormsModule具体如图所示:
1万+
2528
486
362
4077
1万+

被折叠的 条评论
为什么被折叠?