Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Architecting Angular Applications with Redux, RxJS, and NgRx

You're reading from  Architecting Angular Applications with Redux, RxJS, and NgRx

Product type Book
Published in Mar 2018
Publisher Packt
ISBN-13 9781787122406
Pages 364 pages
Edition 1st Edition
Languages
Toc

Table of Contents (12) Chapters close

Preface Quick Look Back at Data Services for Simple Apps 1.21 Gigawatt – Flux Pattern Explained Asynchronous Programming Functional Reactive Programming RxJS Basics Manipulating Streams and Their Values RxJS Advanced Redux NgRx – Reduxing that Angular App NgRx – In Depth Other Books You May Enjoy

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 => Rx.Observable.of(data));

// Observable, Observable, Observable
stream$.subscribe(data => console.log(data));

At this point...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}