diff --git a/dist/angular-validation.js b/dist/angular-validation.js index 3d6e780..6a6a5f3 100644 --- a/dist/angular-validation.js +++ b/dist/angular-validation.js @@ -688,7 +688,7 @@ angular.module('validation.directive', ['validation.provider']); * Set initial validity to undefined if no boolean value is transmitted */ var initialValidity = void 0; - if (typeof attrs.initialValidity === 'boolean') { + if (typeof attrs.initialValidity === 'boolean' || attrs.initialValidity ==='true' || attrs.initialValidity ==='false') { initialValidity = attrs.initialValidity; } @@ -697,6 +697,8 @@ angular.module('validation.directive', ['validation.provider']); */ attrs.$observe('validator', function(value) { validation = value.split(','); + var theValue = useViewValue ? ctrl.$viewValue : ctrl.$modelValue; + checkValidation(scope, element, attrs, ctrl, validation, theValue); }); /** diff --git a/src/validator.directive.js b/src/validator.directive.js index 9569d60..ba93522 100644 --- a/src/validator.directive.js +++ b/src/validator.directive.js @@ -310,7 +310,7 @@ * Set initial validity to undefined if no boolean value is transmitted */ var initialValidity = void 0; - if (typeof attrs.initialValidity === 'boolean') { + if (typeof attrs.initialValidity === 'boolean' || attrs.initialValidity ==='true' || attrs.initialValidity ==='false') { initialValidity = attrs.initialValidity; } @@ -319,6 +319,9 @@ */ attrs.$observe('validator', function(value) { validation = value.split(','); + // validation has been updated => make rule fire again + var theValue = useViewValue ? ctrl.$viewValue : ctrl.$modelValue; + checkValidation(scope, element, attrs, ctrl, validation, theValue); }); /**