Jason Warner
Jan 14, 2022

--

combineLatest will merge multiple observables and emit when any of the observables emits. The downside to combineLatest is that it won't emit until all observables have emitted at least once. If you want to start immediately, you use a startWith on each of the observables you want to observe.

Here is a quick StackBlitz to show the behavior. https://stackblitz.com/edit/angular-ivy-vqzxn2?file=src/app/app.component.ts

In these examples, we wanted to wait on one observable and when it completed, use that value in multiple other observables. To do this, you need to use one of the switch operators (concatMap, switchMap, mergeMap, exhaustMap, etc)

--

--

Jason Warner
Jason Warner

Written by Jason Warner

I enjoy everything related to code and being a dev. However, my only skills are showing up and being lucky and I'm not sure if luck is a talent.

Responses (1)