Adding custom validation directive removes all selected values
I added a custom validation directive to ui-select that validates all selected items to make sure each item has a valid email property.
But after validation returns falsy, all selected items gets lost: http://plnkr.co/edit/gW52dvUjMx4ydHEaHa4a?p=preview
Add ng-model-options="{allowInvalid: true}" next to ng-model.
Reference: https://docs.angularjs.org/api/ng/directive/ngModelOptions
I'm also in need of a fix for this issue - and allowing invalid won't work in my situation. I'm researching the right way to handle this, if I find the answer I'll at minimum post here, or try to submit a pull request.
My belief is that the "Angular way" is for the selected items to continue to display in DOM while the ngModelController's model value is undefined and the invalid flag is set. That behavior is consistent with built-in inputs in Angular.
I've submitted a pull request for this issue: https://github.com/angular-ui/ui-select/pull/1359