zip()

The point of this operator is to stitch as many values together as possible. We may be dealing with continuous streams, but also with streams that have a limit to the number of values they emit. You use this operator in the following way:

// combination/zip.jslet stream$ = Rx.Observable.of(1, 2, 3, 4);let secondStream$ = Rx.Observable.of(5, 6, 7, 8);let thirdStream$ = Rx.Observable.of(9, 10); let zippedStream$ = Rx.Observable.zip(  stream$,  secondStream$,  thirdStream$)// [1, 5, 9] [2, 6, 10]zippedStream$.subscribe(data => console.log(data))

As we can see, here, we stitch values together vertically, and by the least common denominator, thirdStream$ is the shortest, calculating the number of emitted values. This means we will take values ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.