本文介绍了如何将Angular2 ngModel用于聚合物纸张输入?错误:“"没有值访问器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个问题,我正在使用angular2β8,聚合物1.0,打字稿.我在使用ngModel数据绑定时遇到问题聚合物纸张输入元件

This is my first question,I'm using angular2.beta.8, polymer 1.0, typescript.I'm having a problem when I use ngModel data binding withpolymer paper-input element

基本上不过是类中带有ngModel和变量的元素. 运行时会产生此错误:"

Basically nothing more than an element with ngModel and variable in the class. Running that creates this error: No value accessor for ''

我最近才开始使用角为2的聚合物,也许这是个难题,但我似乎找不到任何涉及该主题的信息.

I started to use polymers with angular 2 just recently, and maybe this is noobie question, but I can't seem to find any information covering this topic.

我已经搜索了很长时间这个错误,我觉得除了问你们之外,我别无选择.

I have searched for this error for quite some while and I feel like I have no options left other than ask you guys.

推荐答案

您需要添加ngDefaultControl

<paper-input [(ngModel)]="myModel" ngDefaultControl></paper-input>

另请参见 https://github.com/angular/angular/issues/5360

这篇关于如何将Angular2 ngModel用于聚合物纸张输入?错误:“"没有值访问器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 17:28