-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
There is no way to detect if custom control flags has changed.
Expected behavior
Maybe add to ControlValueAccessor new optional methods like setPristineState(isPristine: boolean)? etc.
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-pybpep
Enter some value to every input to mark it as dirty and the click "clear".
Inner controls are still dirty - that's expected. What's wrong however is that there is no simple way to appropriately change it.
What is the motivation / use case for changing the behavior?
Look at the reproduction example. In my form, errors are shows only when control is dirty or touched (user somehow interacted with it). When I clear the form I want to set all controls state back to pristine and untouched. Unfortunately, there is no easy way to detect that my custom control (NameInput) status has changed and to inform inner controls to change it as well.
Environment
Angular version: 6.0.4