diff --git a/src/angular-validator.js b/src/angular-validator.js index 0ac0e0d..6445d85 100644 --- a/src/angular-validator.js +++ b/src/angular-validator.js @@ -209,7 +209,7 @@ angular.module('angularValidator').directive('angularValidator', ['$injector', ' // Only add validation messages if the form field is $dirty or the form has been submitted - if (scopeElementModel.$dirty || (scope[element.form.name] && scope[element.form.name].submitted)) { + if (scopeElementModel.$dirty || scopeForm.submitted) { if (scopeElementModel.$error.required) { // If there is a custom required message display it @@ -272,7 +272,7 @@ angular.module('angularValidator').directive('angularValidator', ['$injector', ' // Only add/remove validation classes if the field is $dirty or the form has been submitted - if (formField.$dirty || (scopeForm.submitted)) { + if (formField.$dirty || scopeForm.submitted) { if (formField.$invalid) { angular.element(element.parentNode).addClass('has-error'); @@ -286,4 +286,4 @@ angular.module('angularValidator').directive('angularValidator', ['$injector', ' } }; } -]); \ No newline at end of file +]);