angularjs-dropdown-multiselect
angularjs-dropdown-multiselect copied to clipboard
Make directive compatible with NgModelController so it works with forms
Hi there,
I wanted your multiselect to be able to take advantage of built-in Angular forms functionality like $dirty and $pristine states, validation, and whatnot, so I made your directive compatible with NgModelController (see the "Implementing custom form controls" section of the Angular guide). This change also makes your component compatible with, say, angular-unsavedChanges.
It's (hopefully) fairly straightforward, requiring ngModel and using NgModelController.$viewValue and NgModelController.$setViewValue() instead of selectedModel .
However, it is a _breaking_ change in that all consumers must set the ng-model attribute _instead_ of the current selected-model attribute (which is removed). This behavior is consistent with standard form Angular controls, so hopefully makes for more standard usage.
Thanks!
Just plain awesome ! Thanks a lot for sharing this. kbjp
Thanks for the kind words @kbjp!
Are there any plans to merge this PR?
:+1: