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
  1. import { take } from 'rxjs/operators';
  2. import { interval } from 'rxjs/observable/interval';
  3. const source = interval(1000);
  4. const example = zip(source, source.pipe(take(2)));
  5. //output: [0,0]...[1,1]
  6. const subscribe = example.subscribe(val => console.log(val));