I have tried to get data from BehSubject this.visible$
only in case when this.redraw$
happends.
It works, but if the this.visible$
is changed somewhere the prev stream again works. How to avoid it?
this.redraw$.pipe(mergeMap(() => this.visible$)).subscribe((userfavourite: UserFavourite[]) => {}
As solution I can do this:
this.redraw$.subcribe(() => {
this.visible$.subscribe((userfavourite: UserFavourite[]) => {}
});
CodePudding user response:
Maybe something like:
this.redraw$.pipe(
withLatestFrom(this.visible$),
map(([_,v]) => v)
).subscribe(visible => {
/* Do Something */
});