-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Which @angular/* package(s) are relevant/releated to the feature request?
forms
Description
The ability for AbstractControl-based classes (such as FormControl) 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 current valueChanges and statusChanges is the most straightforward way to extend AbstractControl, however, as the number of such observables increases (for example pristine, dirty, etc) it might become less ergonomic and more expensive to maintain.
Proposed solution
We could introduce a new observable (and still support valueChanges and statusChanges for 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.