Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add controlvalue$ function that adds the startingValue of a form to its value changes #544

Open
endlacer opened this issue Jan 22, 2025 · 0 comments

Comments

@endlacer
Copy link

I often find myself to do the following:

const value$ = this.control.selectIndicator.valueChanges.pipe(startWith(this.control.selectIndicator.value));

Which can get quite lengthy especially when you have nested forms.


Thats why I would propose a simple function that encapsulates this:

function controlvalue$<T>(control: AbstractControl<T>): Observable<T> {
  return control.valueChanges.pipe(startWith(control.value));
}

Would you be interested in such a function? I would do a PR then.
(Open for naming suggestions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant