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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JamieCheung/article/details/79191064

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
具体如图所示:

猜你喜欢

转载自blog.csdn.net/JamieCheung/article/details/79191064