Skip to content
Open
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
8 changes: 8 additions & 0 deletions dist/angular-validation-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
},
maxlength: function(value, scope, element, attrs, param) {
return !value || value.length <= param;
},
equality: function (value, scope, element, attrs, param) {
var paramVal = document.querySelector('input[name=' + param + ']').value
Copy link
Owner

Choose a reason for hiding this comment

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

You should be able to use attrs[ param ] instead of globally selector from document.

return value && paramVal && value == paramVal;
}
};

Expand Down Expand Up @@ -41,6 +45,10 @@
maxlength: {
error: 'This should be shorter',
success: 'Short enough!'
},
equality: {
error: "Fields is not equal",
success: "Fields is equal!"
}
};
$validationProvider.setExpression(expression).setDefaultMsg(defaultMsg);
Expand Down