( example tests )
Example 1: Mapping to inner interval observable
( StackBlitz )
import { take, map, combineAll } from 'rxjs/operators';import { interval } from 'rxjs';// emit every 1s, take 2const source$ = interval(1000).pipe(take(2));// map each emitted value from source to interval observable that takes 5 valuesconst example$ = source$.pipe(map(val =>interval(1000).pipe(map(i => `Result (${val}): ${i}`),take(5))));/*2 values from source will map to 2 (inner) interval observables that emit every 1s.combineAll uses combineLatest strategy, emitting the last value from eachwhenever either observable emits a value*/example$.pipe(combineAll())/*output:["Result (0): 0", "Result (1): 0"]["Result (0): 1", "Result (1): 0"]["Result (0): 1", "Result (1): 1"]["Result (0): 2", "Result (1): 1"]["Result (0): 2", "Result (1): 2"]["Result (0): 3", "Result (1): 2"]["Result (0): 3", "Result (1): 3"]["Result (0): 4", "Result (1): 3"]["Result (0): 4", "Result (1): 4"]*/.subscribe(console.log);
combineAll 📰 - Official docs
📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/combineAll.ts