Closed JeanMeche closed 1 week ago
It would be nice if the Formgroup could have a getter to tell us if it has been submitted, too
Yeah, having existing getters for the types of events captured the with this unified events API has been really nice. For example:
export function touchedEvents$<T>(form: AbstractControl<T>) {
return form.events.pipe(
filter(
(event: ControlEvent): event is TouchedEvent =>
event instanceof TouchedEvent
)
);
}
observableValue$ = this.touchedEvents$(form).pipe(startWith(form.touched))
$signalValue = toSignal(this.observableValue$);
For value
/status
/pristine
/touched
events exposed so far. These initial values allow not just observables but also toSignal
ed things to have a starting value. Having a getter to get the status of the submit at the time of the startWith
would be great for things like this, as well as other use cases beyond this.
caretaker: g3 presubmit is green (see above)
This PR was merged into the repository by commit fedeaac8ba85002e34dbd6ffa682d7483d39b5fd.
This commit add 2 new events sent over the unified event observable.
Fixes #54599