Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(input): input error messages visible on form submit
Browse files Browse the repository at this point in the history
Added check for parent form `$submitted` attribute.

Notice that `novalidate` attribute should be applied on parent form in order to make it work (Browser preventing submit when not specified)

fixes #5752
  • Loading branch information
EladBezalel committed Dec 4, 2015
1 parent f6e97a0 commit 6ce708e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function inputTextareaDirective($mdUtil, $window, $mdAria) {
}

var isErrorGetter = containerCtrl.isErrorGetter || function() {
return ngModelCtrl.$invalid && ngModelCtrl.$touched;
return ngModelCtrl.$invalid && (ngModelCtrl.$touched || ngModelCtrl.$$parentForm.$submitted);
};
scope.$watch(isErrorGetter, containerCtrl.setInvalid);

Expand Down

0 comments on commit 6ce708e

Please sign in to comment.