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
- Module 12 overview and checklist
- Reactive programming, Observables and Observers
- Subjects: Subject, BehaviorSubject, ReplaySubject, AsyncSubject
- Operators: categories and everyday operators
- Higher-order observables: switchMap, mergeMap, concatMap, exhaustMap
- Error handling, completion and subscription management
- AsyncPipe, Signals interop, testing and choosing operators