What is AsyncPipe?

Let's learn how we can use Async Pipe to manage the subscribing and unsubscribing of Observables.


One important pipe that we can use in our templates is the AsyncPipe. This works with Observables and helps manage the Subscribing and Unsubscribing from Observables that are used in our components.

The AsyncPipe will return the last value emitted from an Observable and tells the Observable that the value can be checked for the next value in the stream. It will also automatically unsubscribe from the Observable when the component is destroyed or no longer in the UI. This automatic unsubscribing helps reduce the risk of memory leaks in our applications. They can still happen if we don’t unsubscribe in our Services when using Observables, but the AsyncPipe is extremely useful when used in components.


Here is an example showing how AsyncPipe can be used:

Get hands-on with 1200+ tech skills courses.