How do you use FormController#addControl ?

347 views
Skip to first unread message

Jean Dat

unread,
Jun 12, 2015, 1:20:47 PM6/12/15
to ang...@googlegroups.com
Hi,

I'm using angular 1.2.28.

As I understand things, ngModel works only for standard form controls like input, checkbox, etc.

Nonetheless, it seems possible to create your own control with FormController#addControl. 
I'm guessing it accepts an instance of NgModelController as parameter.

Is there documentation and code sample for that out there.
I can't find anything.

Thanks.

Jean Dat

unread,
Jun 17, 2015, 3:56:05 AM6/17/15
to ang...@googlegroups.com
I choose another path. You don't have to use addControl. Indeed, adding ng-model on any html tag add a new NgModelController instance to your FormController. However, you will have to define what update the view value with $setViewValue and what happens when model is updated with $render. An exemple here : http://truffles.me.uk/turn-anything-into-an-ng-model-with-ngmodelcontroller 
Reply all
Reply to author
Forward
0 new messages