concat()

At first look, the concat() operator looks like another merge() operator, but this is not entirely true. The difference is that a concat() waits for other streams to be completed first before emitting a stream from the next stream in order. How you arrange your stream in your call to concat() matters. The operator is used in the following way:

// combination/concat.jslet firstStream$ = Rx.Observable.of(1,2,3,4);let secondStream$ = Rx.Observable.of(5,6,7,8);let concatStream$ = Rx.Observable.concat(  firstStream$,  secondStream$);concatStream$.subscribe(data => console.log(data));

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.