Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
fix(ngModel): use setValidity for Angular < 1.3 and $validators for >…
Browse files Browse the repository at this point in the history
…= 1.3
  • Loading branch information
Philipp Burgmer committed Sep 21, 2016
1 parent e1153ea commit 89b441f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/w11k-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,14 @@ angular.module('w11k.select').directive('w11kSelect', [
controller.$render = render;
controller.$formatters.push(external2internal);

controller.$validators.required = validateRequired;
if (angular.version.major === 1 && angular.version.minor < 3) {
controller.$parsers.push(function (viewValue) {
controller.$setValidity('required', validateRequired(viewValue));
});
} else {
controller.$validators.required = validateRequired;
}

controller.$parsers.push(internal2external);


Expand Down

0 comments on commit 89b441f

Please sign in to comment.