'How to transform combineLatest to switchMap?
I have to observables, i know there is a way to transform combineLatest to switchMap but i dont get it
combineLatest([
faviconServiceOutgoingEvents.ready.listen().pipe(mapTo(true), startWith(false)),
this.brandService.brandName$,
]).subscribe(([isServiceReady, brandName]) => {
if (isServiceReady) {
faviconServiceIncomingEvents.changeIcon.send(brandName);
}
});
Solution 1:[1]
solution was near
faviconServiceOutgoingEvents.ready
.listen()
.pipe(
switchMap(() => {
return this.brandService.brandName$;
}),
)
.subscribe(brandName => faviconServiceIncomingEvents.changeIcon.send(brandName));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sam Kazantsev |
