-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix(select): errors not shown on submit #7640
fix(select): errors not shown on submit #7640
Conversation
Fixes `mat-select` error messages not being shown when the parent form is submitted. Fixes angular#7634.
I was thinking we should just move all the |
My issue with having it there is that some bindings on the form field control depend on it (e.g. the |
Hmmm I see, what if we changed to, instead of an @Directive({
...
providers: [{provide: ErrorStateMatcher, useExisting: MatErrorStateMatcherDirective}]
})
export class MatErrorStateMatcherDirective implements ErrorStateMatcher {
@Input('matErrorStateMatcher') errorStateMatcher: ErrorStateMatcher;
isErrorState(...) {
return this.errorStateMatcher.isErrorState(...);
}
} This way form field and input could both just inject the token and not worry about dealing with the <form class="my-special-error-group" [matErrorStateMatcher]="myMatcher">
<!-- bunch of form fields that all get my custom matcher -->
</form> |
I don't think that would react to changes either. Angular marks it for checking if the |
Ok then, let's do this for now, I'll keep thinking if there's any good way to move this common logic somewhere else... |
@crisbeto when will this fix be released? |
Is this fix released? |
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. |
Fixes
mat-select
error messages not being shown when the parent form is submitted.Fixes #7634.
@mmalerba this is more or less what the input does already. I was considering moving it into the
MatFormFieldControl
, but having lifecycle hooks in there might look weird. What do you think?