Lesson

Avoid memory leaks when subscribing to RxJS Observables in Angular Components

Subscribing to RxJS Observables is a common operation in Angular components. However, we need to pay attention at also cleaning up our subscriptions when our component gets destroyed. This especially holds for those type of Observables that do not immediately...

Duration
5 min
Access
Free
Transcript
Available

Subscribing to RxJS Observables is a common operation in Angular components. However, we need to pay attention at also cleaning up our subscriptions when our component gets destroyed. This especially holds for those type of Observables that do not immediately complete (like the ones returned from Angular's HttpClient). In this lesson we're going to take a look at different approaches for unsubscribing and how the async pipe can take away a lot of this burden. Also make sure to check out this article on "RxJS: Avoid takeUntil leaks"