I've used the addClassRules function in jQuery Validate very often. It's handy when I need the same validation on multiple fields that have different names but the same class. I have not been able to get this working using your angular implementation.
I tried modifying the angular .provider function in angular-validate.js like this, but it didn't work.
.provider('$validator', function () {
$.validator.setDefaults({
onsubmit: false // to prevent validating twice
});
return {
setDefaults: $.validator.setDefaults,
addMethod: $.validator.addMethod,
addClassRules: $.validator.addClassRules, // I added this line
setDefaultMessages: function (messages) {
angular.extend($.validator.messages, messages);
},
format: $.validator.format,
$get: function () {
return {};
}
};
});
I've used the
addClassRules
function in jQuery Validate very often. It's handy when I need the same validation on multiple fields that have differentname
s but the same class. I have not been able to get this working using your angular implementation.I tried modifying the angular
.provider
function in angular-validate.js like this, but it didn't work.Do you know how I can get this working? Thanks.