-
Notifications
You must be signed in to change notification settings - Fork 1.8k
required or ng-required not working with ui-select 'multiple' option #914
Comments
I found this solution here
angular.module('common').directive('uiSelectRequired', function () {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
ctrl.$validators.uiSelectRequired = function (modelValue, viewValue) {
add ui-select-required |
Thanks imaa! It is working well. The error msg also started showing up when I change the condition from: Wondering, can this be merged with the main repository or with ng-required itself with more sophistication to handle $error.required as well? |
ng-required or only required not work with "<ui-select multiple tagging" for me too. |
I confirm the behaviour - when |
I just submitted a PR to fix this issue. It will allow you to just put PR Link: #1025 |
That's great Cole. Thank you. |
The solution above works for me as well. Thanks! |
@improvisio how did you get the solution above working? I added the module then added ui-select-required in the ui-select tag but its not working. |
@GilbertChan I first added the directive as shown above: #914 (comment) |
Thanks, @imaa it works! |
Check only required param doesn't work for me if i set ng-required="true", but code below works fine if (angular.isDefined(attrs.multiple) && (angular.isDefined(attrs.required) || angular.isDefined(attrs.ngRequired)) ) { |
My solution
|
@macem Thanks alot that helped |
@macem Thanks as well, |
Resolved by #1492 |
required or ng-required=true is working fine with ui-select when the control is expected to select single value. However, with 'multiple' option, it is not working. The model presumes the value as array [], and marks it as valid=true.
Am I the only one facing this issue? Is this issue already addressed in the next version?
The text was updated successfully, but these errors were encountered: