首页 > 代码库 > Angular4 - Can't bind to 'ngModel' since it isn't a known property of 'input'.

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

用[(ngModel)]="xxx"双向绑定,如:技术分享控制台报错:Can‘t bind to ‘ngModel‘ since it isn‘t a known property of ‘input‘.

 

解决办法:在app.module.ts文件中导入FormsModule

 

技术分享

 

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