-
Notifications
You must be signed in to change notification settings - Fork 6.8k
mdInput does not update with form control status when submit #5210
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
Comments
This seems like probably incorrect usage of the forms API since even after switching to native inputs I see the following error in the plunker:
here's a version of the plunker updated to work with latest beta and inputs switched to native inputs: https://plnkr.co/edit/8u5gM3bJOn3EizjyLp0m?p=preview @kara do you know the correct way to accomplish this? |
Hi Thanks for taking a look of this The error seems to be related with the way to display the development message, please check the updated plunker |
I am not able to run original plunker due to some error in System.js config. |
Ok, I switched it back to md-input-containers (https://plnkr.co/edit/rLi6SeY3OxDheTZHLjRW?p=preview) and I see the issue with no errors in the console, will take another look. |
Working plunker: https://plnkr.co/edit/w3nDfjlVVvHOzxW6d6vO?p=preview I tried to experiment with leaving Form group is injected via DI here: https://github.com/angular/material2/blob/2.0.0-beta.8/src/lib/input/input-container.ts#L237 (which injects closest |
Hi tytskyi Thanks for the update, so the only way is to use [formControl] instead of formControlName. Thank you! As for the validator, just follow the recommendation from angular doc. That does not seems to work on md-select though. |
@sashanana md-select error state doesn't take submitted state into account (which is a bug) filed #5826 to track that. For this issue @tytskyi is correct, seems to be an issue with how forms API was being used, his example shows the correct way. |
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?
Invalid formControl of formGroup should shown error and update related style when submit.
What is the current behavior?
Invalid formControl of formGroup does not show error and does not update related style when submit.
_form.status is invalid.
What are the steps to reproduce?
https://plnkr.co/edit/rQXSXREDhy9w7oet1ZhB?p=preview
Current: Favorite food is highlighted as required, Favorite dessert is seen as untouched
Expected: Favorite food and Favorite dessert would be highlighted as required
What is the use-case or motivation for changing an existing behavior?
formGroup component could group html, css, and validation of related formControl together which could be reuse easily
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 4.0.3
Material: 2.0.0-beta.6
Is there anything else we should know?
Thanks
The text was updated successfully, but these errors were encountered: