From 94b8d39aad954ea59d7490e128866766c0d44d60 Mon Sep 17 00:00:00 2001 From: Steve Saxton Date: Tue, 4 Jul 2017 17:20:01 +0400 Subject: [PATCH 1/2] Allow set with initial-validity && re-fire validators if they are updated --- src/validator.directive.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); }); /** From 606881a77c9ce46a97a372ac83799b81aaba65f9 Mon Sep 17 00:00:00 2001 From: Steve Saxton Date: Wed, 12 Jul 2017 17:28:38 +0530 Subject: [PATCH 2/2] fixed for updates --- dist/angular-validation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); }); /**