在Angular项目中使用[(ngModel)]双向数据绑定时提示:

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

Angular中提示:Can't bind to 'ngModel' since it isn't a known property of 'input'

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

解决

这是因为在使用双向数据绑定[(ngModel)]时必须引入FormsModule这个模块。

打开app.module.ts

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

 

并添加声明

Angular中提示:Can't bind to 'ngModel' since it isn't a known property of 'input'

 

 

Angular中提示:Can't bind to 'ngModel' since it isn't a known property of 'input'

相关文章:

  • 2021-12-04
  • 2021-05-24
  • 2021-07-21
  • 2021-09-06
  • 2022-12-23
  • 2021-10-09
  • 2021-06-05
  • 2022-12-23
猜你喜欢
  • 2021-04-16
  • 2021-04-20
  • 2021-07-14
  • 2021-06-15
  • 2021-04-25
  • 2022-12-23
相关资源
相似解决方案