I am trying to do the validation of ui-select with the option multiple option. But no angular validation works. Even creating a custom validation. That always returns invalid.
Only remove the (multiple) option that all validations work (required and customized)
<ui-select multiple ng-model="Model.Test" close-on-select="false"
search-enabled="true" required custom-validation>
<ui-select-match allow-clear="true">{{$item.Name}}</ui-select-match>
<ui-select-choices repeat="item in Items | filter:$select.search">
<div ng-bind-html="item.Name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
app.directive('customValidation', function () {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
ctrl.$validators.customValidation = function (modelValue, viewValue) {
return false;
};
}
};
});
It works better if the validator returns
true: