This repository was archived by the owner on Sep 5, 2024. It is now read-only.
input: label does not exist when 'required' attribute changes, throws "Cannot read property 'toggleClass' of null" #10831
Labels
has: Pull Request
A PR has been created to address this issue
P3: important
Important issues that really should be fixed when possible.
resolution: fixed
type: bug
Milestone
Actual Behavior:
What is the issue? *
Angular material tries to toggle the "required" CSS class on a label when an input's bound required value changes, without checking if the label still exists.
What is the expected behavior?
Because material labels remove themselves from the inputContainer when their scope is destroyed, the associated material input needs to verify the label member is still defined on the inputContainer before attempting to access its toggleClass member.
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:
https://codepen.io/dbarnespaychex/pen/YxGgEw?editors=1111Details:
There actually appear to be 2 issues, but the one that we're seeing is
Cannot read property 'toggleClass' of null
. Check out https://github.com/angular/material/blob/master/src/components/input/input.js#L168 and https://github.com/angular/material/blob/master/src/components/input/input.js#L418.The bug is in
setupAttributeWatchers
:AngularJS Versions: *
AngularJS Version:
n/aAngularJS Material Version:
1.1.1+Additional Information:
Browser Type: *
n/aBrowser Version: *
n/aOS: *
n/aStack Traces:
The text was updated successfully, but these errors were encountered: