Form validators re-run on view (re)creation #19465
Labels
area: forms
forms: validators
freq2: medium
P4
A relatively minor issue that is not relevant to core functions
state: confirmed
type: bug/fix
Milestone
I'm submitting a...
Current behavior
When the directive associated with a form control is created in the view, validators are triggered.
Expected behavior
Validators should not be triggered when the view changes. Reactive forms should not be tied to the way they are represented in the view. Their source of truth should be the model.
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-reactive-forms-issue?file=app/app.component.ts
What is the motivation / use case for changing the behavior?
Observe the fact that error message is now gone. Toggling the view is mocking the use-case of having a mulitpart form.
If this is by design, I don't see a reason for it. We're creating a view where we write data form model to view. The action of reading from model should not trigger validators, as far as I understand. As I see it, validators should be run when the
FormControl
instances are created in the model. Why are validators triggered when value did not change?Environment
The text was updated successfully, but these errors were encountered: