netceteragroup / valdr

A model centric approach to AngularJS form validation
http://netceteragroup.github.io/valdr/
MIT License
153 stars 43 forks source link

How to add a new custom message for my custom directive using valdr #93

Closed krunalsheth3 closed 9 years ago

krunalsheth3 commented 9 years ago

I have a directive created for validating passowrd and confirm password fields The directive looks like this

.directive('compareTo', function(){ // Runs during compile return { require: "ngModel", scope: { otherModelValue: "=compareTo" }, link: function(scope, element, attributes, ngModel) {

                ngModel.$validators.compareTo = function(modelValue) {
                    return modelValue == scope.otherModelValue;
                };

                scope.$watch("otherModelValue", function() {
                    ngModel.$validate();
                });

            }
};

});

The link function does return me the correct boolean value, but the how do I display the error message ? The error element did show up with a red icon but the message besides it is empty. Where do I initialize this message ?

REF: http://stackoverflow.com/questions/33247745/valdr-how-to-add-a-new-message-in-using-valdr

marcelstoer commented 9 years ago

Tracking in SO is enough. This issue list is for bug reports and feature requests.

krunalsheth3 commented 9 years ago

ok Thanks. But please can you reply on SO ?

On Wed, Oct 21, 2015 at 2:07 PM, Marcel Stör notifications@github.com wrote:

Tracking in SO is enough. This issue list is for bug reports and feature requests.

— Reply to this email directly or view it on GitHub https://github.com/netceteragroup/valdr/issues/93#issuecomment-149980233 .