So you are starting to flex your new Angular 2 muscles and have built the mother of all custom form controls. I mean that thing can do everything except make coffee… And then the moment comes to extract and use it as a separate component in your application.

You plug it into your HTML form with ngControl, thinking your work is done and as your browser refreshes you start seeing all sorts of errors appearing on the console. Attaching it to ngModel produces similar errors.

As it turns out, your journey is far from over and today we will take a look at whatAngular2 expects from you if you want to build components that can talk to directives like ngControl and ngModel.

Source: Angular 2: Connect your custom control to ngModel and ngControl with Control Value Accessor.

Leave a Reply