Skip to Main Content
Mastering Angular Components - Second Edition
book

Mastering Angular Components - Second Edition

by Gion Kunz
July 2018
Intermediate to advanced content levelIntermediate to advanced
402 pages
9h 35m
English
Packt Publishing
Content preview from Mastering Angular Components - Second Edition

Subscribing in the view using the async pipe

We have learned about RxJS observables and that they will not start to emit items if we don't subscribe to them. You can compare this to the analogy of the drain valve of a water pipe. If you don't open the drain, the water will not flow.

Within our updated task list component, we now have a filteredTasks observable to which we can subscribe to and obtain the latest filtered tasks. However, there's a slightly better way to handle RxJS subscriptions, which we're going to take a look at now.

The problem with subscriptions is that they always want to be cleaned up too. Imagine your subscription is causing many event handlers to be added and other resources which might get allocated for observing your ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Angular, 2nd Edition

Learning Angular, 2nd Edition

Brad Dayley, Brendan Dayley, Caleb Dayley
Essential Angular

Essential Angular

Victor Savkin, Jeff Cross
Pro Angular 6

Pro Angular 6

Adam Freeman

Publisher Resources

ISBN: 9781788293532Supplemental Content