O'Reilly logo

Mastering Angular Components by Gion Kunz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required