Skip to main content

Combining streams and sharing results

Learn Combining streams and sharing results (Module 12 · RxJS, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Joining streams • combineLatest([a$, b$]) : whenever any source emits, emit the latest values of all (after each has emitted once). Like a dashboard showing the latest of several gauges. • forkJoin([a$, b$]) : wait until all complete, then emit the last values once. Like Promise.all for HTTP calls. • merge(a$, b$) : interleave values from all, as they come. • concat(a$, b$) : run a$ fully, then b$. • withLatestFrom(b$) : when the main stream emits, also take the latest value of b$ (b$ alone does not trigger).

More lessons in Module 12 · RxJS