-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Description
Hello, I've been going through the documentation of the HttpClient service (https://angular.io/guide/http) trying to find any mention of whether it is necessary to unsubscribe from the generated observables or not, and the only mention I could find was about using the AsyncPipe, which is irrelevant (because we don't have to or might not want to use it).
So, I think the documentation should clarify when (if ever) we need to unsubscribe from calls.
Update:
Perhaps I should clarify a bit more. This article:
https://medium.com/angular-in-depth/why-you-have-to-unsubscribe-from-observable-92502d5639d0
explains very well the reasons why we should unsubscribe from all HttpClient observables always.
Personally, I've struggled to convince my team to do it, because their usual answer is that HttpClient will do it automatically and of course very few people bother to read beyond the official documentation which doesn't mention anything about unsubscribing.
I have been doing it for a long time with Net Basal's excellent ng-neat/until-destroy library, but I feel that this is such a core concept of any real-life Angular app that it should be clearly documented.