Skip to content

Commit

Permalink
build dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri Shaiko committed Feb 27, 2015
1 parent b607863 commit 69e7ed7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions dist/angular-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ angular.module('angularValidator').directive('angularValidator',
}
});

// Watch form length to add watches into new form elements
scope.$watch(function(){return DOMForm.length;}, function(){
setupWatches(DOMForm);
});

// Setup watches on all form fields
setupWatches(DOMForm);

Expand All @@ -51,6 +56,12 @@ angular.module('angularValidator').directive('angularValidator',
// Setup $watch on a single formfield
function setupWatch(elementToWatch) {

//Prevent to re-watch the element
if (elementToWatch.isWatchedByValidator){
return;
}
elementToWatch.isWatchedByValidator = true;

// If element is set to validate on blur then update the element on blur
if ("validate-on" in elementToWatch.attributes && elementToWatch.attributes["validate-on"].value === "blur") {
angular.element(elementToWatch).on('blur', function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-validator.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 69e7ed7

Please sign in to comment.