Skip to content
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

FormGroup.reset() does not reset validation #9347

Closed
farley911 opened this issue Jan 11, 2018 · 3 comments
Closed

FormGroup.reset() does not reset validation #9347

farley911 opened this issue Jan 11, 2018 · 3 comments

Comments

@farley911
Copy link

farley911 commented Jan 11, 2018

Bug, feature request, or proposal:

Bug

What is the expected behavior?

FormGroup.reset() should reset the form validation

What is the current behavior?

FormGroup.reset() sets the form classes to ng-pristine and ng-untoched but FormControl.hasError(...) still returns truthy.

What are the steps to reproduce?

Plunker: http://embed.plnkr.co/Hlivn4/

  • Create reactive form
  • Add fields and set the validation to required
  • Enter something into the fields
  • Call FormGroup.reset() method

What is the use-case or motivation for changing an existing behavior?

FormGroup.reset() should reset the form to it's initial state including removing validation errors.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular ^5.0.0, Material 5.0.0

Is there anything else we should know?

@willshowell
Copy link
Contributor

Please see #4190 and particularly #4190 (comment).

If you want to customize under which conditions mat-error is shown, consider implementing your own ErrorStateMatcher.

@josephperrott
Copy link
Member

Closing as duplicate of #4190

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants