How to use Angular2 ngModel for Polymer paper-input? ERROR: No value accessor for '' [duplicate]

北战南征 提交于 2019-12-04 02:31:41

问题


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 with polymer paper-input element

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

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.


回答1:


You need to add ngDefaultControl

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

See also https://github.com/angular/angular/issues/5360



来源:https://stackoverflow.com/questions/35867952/how-to-use-angular2-ngmodel-for-polymer-paper-input-error-no-value-accessor-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!