ngModel: No value accessor for ''

后端 未结 10 2260
暖寄归人
暖寄归人 2020-12-09 15:08

I\'m creating a custom element in Angular 2.0 (), and when I include the ngModel attribute on the component, I\'m immediately hit with the foll

10条回答
  •  我在风中等你
    2020-12-09 15:51

    I got the same problem. I figured that I tried to two-way bind my variable to a element and then get that value in an attribute:

    Username is required.

    As you can see, there's no way for the view to modify the _hidden variable in the model. Fixing the binding to one-way worked:

    Username is required.

    Notice the change from [(ngModel)] to (ngModel).

提交回复
热议问题