I have this code to figure out if the element is valid or invalid in my directive :
myModule.directive('myDirective',function(){ return { restrict: 'A', scope: {}, require:'ngModel', link: function(scope,element,attrs,ctrl){ if(ctrl.$invalid){ //do something } } }}); So my problem is how can I determine which type of validation is invalid, required? max-length? my other custom-validations?
Because I need to generate proper validation-message to show.