Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dist/angular-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
});

/**
Expand Down
5 changes: 4 additions & 1 deletion src/validator.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests fail because the checkValidation will be called in the initialization phase, it should trigger only there is a change on validator.

});

/**
Expand Down