-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
md-select errors still displayed even after resetting formGroup #7522
Comments
I think this is expected behavior, per #4190. |
After submitting the form and resetting it, the intuitive thing is to clear md-select from all sort of errors; Is there a good approach to achieve this ? Thank you very much. |
After you reset the form, that is what happens. You are asking that by resetting your -- #4190 (comment) pretty much covers it:
|
I think there is a misunderstanding, i understand that in order to remove all errors after submission we need to gain access to FormGroupDirective or the NgForm and call resetForm() on it, but the problem is that just remove .mat-input-invalid from all inputs and not .mat-select.invalid from all selects components ! So my question is how to remove also all .mat-select.invalid from all selects components ? Thank you very much and i'm sorry if i'm not getting something right. |
I'm still not sure I understand 😄 . Here's an example of this approach clearing the invalid styles for inputs and selects: https://stackblitz.com/edit/material2-beta11-8ylcrf?file=app%2Fapp.component.ts And here's some additional clarification, if it helps: By default, Material shows the invalid styling when the control |
This is working as intended. As @willshowell mentioned, you can use a custom error state matcher to change when errors are shown |
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. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
after resetting the formGroup the error associated with md-select should disappear
What is the current behavior?
after resetting the formGroup the error associated with the md-select still displayed
What are the steps to reproduce?
Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.
Plunker starter (using on
@master
): https://goo.gl/DlHd6UStackBlitz starter (using latest
npm
release): https://goo.gl/wwnhMVWhat is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.3.3
Material 2.0.0-beta.11
Windows 10
Typescript 2.5.2
Browser Google Chrome 61.0.3163.100
Is there anything else we should know?
In order to reset the formGroup i use the technique described here : #4190
Thanks.
The text was updated successfully, but these errors were encountered: