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

1

0

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.

Connive answered 8/3, 2016 at 12:53 Comment(0)
R
4

You need to add ngDefaultControl

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

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

Risa answered 8/3, 2016 at 12:54 Comment(7)
You are god. Thank you. :)Mirage
there's a typo on the closing tag. <paper-intput>, it should be </paper-input>. trivial, but does not allow to copy&paste the snippet :)Euchologion
Thanks a lot @Euchologion ! Fixed.Verbenia
This doesn't work for me. I remember it used to work but with angular 2.1.0 it doesn't. Anything changed?Zoophilia
Sorry, no idea. Haven't used it since then.Verbenia
@GünterZöchbauer Do you know of any way you can avoid using ngDefaultControl? I have a wrapping container as a layer of abstraction on a 3rd party component (ngPrime autocomplete) with formControl.Ina
You shouldn't need ngDefaultControl at all with Angular components. Angular components should implement ControlValueAccessor.Verbenia

© 2022 - 2024 — McMap. All rights reserved.