Stream in a stream

We have been looking at different operators that change the values being emitted. There is another different aspect to streams: what if you need to create a new stream from an existing stream? Another good question is: when does such a situation usually occur?  There are plenty of situations, such as:

  • Based on a stream of keyUp events, do an AJAX call.
  • Count the number of clicks and determine whether the user single, double, or triple-clicked.

You get the idea; we are starting with one type of stream that needs to turn into another type of stream.

Let's first have a look at creating a stream and see what happens when we try to create a stream as the result of using an operator:

let stream$ = Rx.Observable.of(1,2,3) .map(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.