ngModel: No value accessor for ''

后端 未结 10 2256
暖寄归人
暖寄归人 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 16:04

    I think you should use something else than ngModel for the parameter of your my-select component... Because it's already used by Angular2.

    I made a try with model and it seems better... I don't have the error anymore.

    Edit

    If you want to handle ngModel at the level of your my-select component, you could have a look at this link: https://github.com/angular/angular/issues/2543.

    If you want to implement an ngModel-compliant component, you could have a look at the following links:

    • http://restlet.com/blog/2016/02/17/implementing-angular2-forms-beyond-basics-part-2/. See section: NgModel-compatible component
    • Angular 2 custom form input

    Hope it helps you, Thierry

提交回复
热议问题