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)]无法使用的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
解决三元运算符 报错“SyntaxError: can''t assign to conditional expression”
解决angular 使用原生拖拽页面卡顿及表单控件输入延迟问题
使用 Angular RouteReuseStrategy 缓存(路由)组件的实例代码
分享Angular http interceptors 拦截器使用(推荐)
网友评论