zip
signature: zip(observables: *): Observable
TL;DR: After all observables emit, emit values as an array
Example 1: zip multiple observables emitting at alternate intervals
Example 2: zip when 1 observable completes
import { take } from 'rxjs/operators';
import { interval } from 'rxjs/observable/interval';
const source = interval(1000);
const example = zip(source, source.pipe(take(2)));
//output: [0,0]...[1,1]
const subscribe = example.subscribe(val => console.log(val));
- Combination operator: zip
- André Staltz