Forms: Unified Control State Change Events #42862
Comments
14 tasks
|
FYI #31963 has some proposals on how event payload may look like. |
AbstractControlAbstractControl
AbstractControl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Which @angular/* package(s) are relevant/releated to the feature request?
forms
Description
The ability for
AbstractControl-based classes (such asFormControl) to produce more events is a highly requested feature (lots of feedback in #10887, also #41088 and others; #24444 is also a use case). Adding more observables similar to the currentvalueChangesandstatusChangesis the most straightforward way to extendAbstractControl, however, as the number of such observables increases (for examplepristine,dirty, etc) it might become less ergonomic and more expensive to maintain.Proposed solution
We could introduce a new observable (and still support
valueChangesandstatusChangesfor backwards compatibility) containing all events produced in various situations, so it's possible to subscribe, stream, and filter as needed. Each event in this stream might contain additional meta information such as a reference to an instance that produced the event, event type, etc. We would need a unified payload design that works with all the event types, and satisfies the use cases in the above linked issues.However before making a final decision, we'd need to perform more research and design work, to make sure that this approach is viable.
Also note that adding this stream could simplify
ControlValueAccessor, as per #24444 and #27315.Alternatives considered
Adding individual observables on a case-by-case basis is likely infeasible, both from an API consistency perspective and an API bloat perspective.
The text was updated successfully, but these errors were encountered: