Reputation: 14144
Using merge()
to merge 3 sources of the data on the page:
merge(this.sort.sortChange, this.paginator.page, this.searchQuery$)
.pipe(
distinctUntilChanged(),
switchMap(() => {
sort
and paginator
are instant source (user clicks on the control and instantly changes the value. While searchQuery
is generated by the text input field.
I would like to add debounceTime(500)
but only for the searchQuery$
while keeping other 2 sources included.
How does one achieve this with RxJs?
Upvotes: 0
Views: 84
Reputation: 14099
You can add operators in a pipe
to any Observable.
merge(
this.sort.sortChange,
this.paginator.page,
this.searchQuery$.pipe(debounceTime(500))
)
Upvotes: 2