Description
Which @angular/* package(s) are relevant/related to the feature request?
forms
Description
When working with reactive forms, I find myself writing over and over again something like
this.form.valueChanges.pipe(startWith(this.form.value)).subscribe(...)
Could this be reworked to always emit the initial value so that this is abbreviated?
The current behavior could easily be achieved with skip(1)
, of course it would just move the "boilerplate" to the other use case, but I wanted to see if this is something worth discussing, or it's just me that uses the former case much more frequently than the latter (or even if I'm missing some easier way to achieve the behavior that I want).
Proposed solution
New usage:
this.form.valueChanges.subscribe(/* subscription receives all values starting with the initial value of the form */)
this.form.valueChanges.pipe(skip(1)).subscribe(/* how to get current behavior */)
Alternatives considered
I've seen some discussion about adding signals to forms, I think it would be a great alternative, because in a lot of cases, I'm using the valueChanges
with toSignal
, so this would already save a lot of repetitive code.