Angular 2:不能绑定到'ngModel',因为它不是'input'的已知属性 [英] Angular 2: Can't bind to 'ngModel' since it isn't a known property of 'input'

查看:229
本文介绍了Angular 2:不能绑定到'ngModel',因为它不是'input'的已知属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Angular 2中实现动态表单。我已经为动态表单添加了删除和取消等附加功能。
我遵循这个文档:



我对代码做了一些更改。我在这里遇到错误。

我如何让这个错误发生?



你可以找到满的代码在这里: http://plnkr.co/edit/SL949g1hQQrnRUr1XXqt?p=preview ,这是在蹲点工作但不在我的本地系统中。



Html代码:

 < ; DIV> 
< form [formGroup] =form>

< div * ngFor =让问题提问class =form-row>
< label [attr.for] =question.key> {{question.label}}< / label>

< div [ngSwitch] =question.controlType>

< input * ngSwitchCase ='textbox'[formControlName] =question.key
[id] =question.key[type] =question.type [(ngModel)] = question.value >

发送“验证码”获取 | 15天全站免登陆