Reputation: 10384
I am implementing a filter feature in Angular, and I have two observables: the items$
observable and the itemsFilter$
observable. The first comes from the store, the second comes from a BehaviourSubject
.
I'm trying to combine these two observables in order to always apply the filter. Even when the data changes and new items are emitted, the filter has to remain applied. Same if the filter changes.
I tried several operators:
itemsFilter$
emitsitemsFilter$
emitsitemsFilter$
emitsIn the end, I didn't find a suitable operator for my use-case. What's the standard way of implementing filters with ngrx and rxjs observables?
Upvotes: 0
Views: 1019
Reputation: 7341
Use combineLatest(args: Observable[])
static import from rxjs
or combineLatestWith
operator.
Only the combineLatest(...args: Observable[])
overload is deprecated. The combineLatest
operator is deprecated.
combineLatest([items$, itemsFilter$])
or
items$.pipe(
combineLatestWith(itemsFilter$),
)
Upvotes: 3