解决angular2在双向数据绑定时[(ngModel)]无法使用的问题
程序员文章站
2023-09-07 23:27:20
angular2在双向数据绑定时[(ngmodel)]无法使用,出现的错误是:
can't bind to 'ngmodel' since it isn't a...
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,
位置如下:
以上这篇解决angular2在双向数据绑定时[(ngmodel)]无法使用的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
上一篇: 香甜的芝士麻球是怎样制作的?方法很简单
下一篇: 看到你妈回来咳嗽一声哪