Repository navigation
fix(material-experimental/form-field): add setLabelRequired adapter - #19284
Conversation
jelbourn
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.