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

Commit 34e0278

Browse files
epelcThomasBurleson
authored andcommitted
fix(input): check if parent form is undefined before checking if it's submitted
Fixes #6807. Closes #6809.
1 parent f079d67 commit 34e0278

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/input/input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ function inputTextareaDirective($mdUtil, $window, $mdAria) {
272272

273273
var isParentFormSubmitted = function () {
274274
var parent = $mdUtil.getClosest(element, 'form');
275+
var form = parent ? angular.element(parent).controller('form') : null;
275276

276-
return parent ? angular.element(parent).controller('form').$submitted : false;
277+
return form ? form.$submitted : false;
277278
};
278279

279280
scope.$watch(isErrorGetter, containerCtrl.setInvalid);

0 commit comments

Comments
 (0)