-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material-experimental/form-field): add setLabelRequired adapter #19284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Feel free to ping me when the corresponding change lands in Google so I can merge this.
Actually it looks like CI is failing here- is there a new MDC version necessary with the change? |
Yes. Once the CL is submitted, we'll need to update this PR with the updated canary build |
Looks like the MDC change made it into a Canary build and got picked up by the cronjob. https://circleci.com/gh/angular/components/139322 |
Working on updating this now! |
983745d
to
cb5b949
Compare
|
||
// TODO: MDC now supports setting the required asterisk marker directly on | ||
// the label component. This adapter method may be implemented and | ||
// mat-mdc-form-field-required-marker removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan that we clean this up as a follow-up? I don't think we'll use that given that we support custom form field controls and/or their associated ng control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's optional to clean up.
I didn't do a deep dive into the component, but it looks like the <span class="mat-mdc-form-field-required-marker">
accomplishes the same goal.
Instead of doing it in markup, you could do it in this method:
setLabelRequired(isRequired: boolean) {
if (!this.hideRequiredMarker && this._control.required && !this.control.disabled) {
// toggles the `mdc-floating-label--required` class
this._floatingLabel.required = isRequired;
}
}
Definitely a lot of opinions and unknowns on my part. Feel free to update the comment and either implement something, or leave it as no-op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I don't think we'll be able to rely on that method since we want to update whenever the input is refreshed, so we rely on change detection. Doing that manually might be overly complicated
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.