angular2在双向数据绑定时[(ngModel)]无法使用,出现的错误是:

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

解决办法:

在文件 app.component.ts 中引入ngModel

具体为:

添加两行代码:

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

FormsModule,

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

相关文章:

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