[ng-core] Feature request: Sync validation errors, touched, and dirty status
It is possible to sync these things 2-ways between the outer and inner form controls. See the example from @DmitryEfimenko at https://github.com/DmitryEfimenko/s-libs-superclass
Update, after much debate, I will put this on hold until after angular 12 is out. Because I don't think I would get the full functionality implemented in time, and there are some quicker wins I could get out the door sooner.
The full list of features that should go together (in draft form, after some brainstorming):
-
pending
-
validation errors
- valid invalid hasError getError
-
touched & untouched
-
dirty & pristine
-
disabled & enabled
-
status
- status changes
-
name
-
path?
The general idea is to fully synchronize the outer NgControl with the inner one, IF that outer control exists. (If it does not exist, no problem, just keep today's behavior without these extra features.)
It looks like support is missing for InjectFlags.Optional, as used at https://github.com/DmitryEfimenko/s-libs-superclass/blob/main/src/app/simple-autocomplete/wrapped-form-control-superclass.ts#L186.
It looks like support may still land in v13? https://github.com/angular/angular/pull/41592 Though it seems like 13 should be fairly locked by now ...
Yeah, this was a while ago. I almost don't remember what was the culprit. Hopefully Angular team can get this PR in for the v13.