From a6865ec61bf3372d0ec89b83a3145ee80549157d Mon Sep 17 00:00:00 2001 From: Michael Prentice Date: Sat, 24 Oct 2020 22:21:03 -0400 Subject: [PATCH] fix(input): check that containerCtrl.label is defined before accessing it Fixes #10831 --- src/components/input/input.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/input/input.js b/src/components/input/input.js index b29da30c97..5554f17e5c 100644 --- a/src/components/input/input.js +++ b/src/components/input/input.js @@ -474,9 +474,11 @@ function inputTextareaDirective($mdUtil, $window, $mdAria, $timeout, $mdGesture) function setupAttributeWatchers() { if (containerCtrl.label) { attr.$observe('required', function (value) { - // We don't need to parse the required value, it's always a boolean because of angular's + // We don't need to parse the required value, it's always a boolean because of AngularJS' // required directive. - containerCtrl.label.toggleClass('md-required', value && !mdNoAsterisk); + if (containerCtrl.label) { + containerCtrl.label.toggleClass('md-required', value && !mdNoAsterisk); + } }); } }