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

fix(input): check that containerCtrl.label is defined before accessing it #12035

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
}
Expand Down