I recently came across articles explaining observable's and because I am new to Angular I have been trying to find out the best possible way to do everything.
I came across this article: https://blog.angularindepth.com/angular-question-rxjs-subscribe-vs-async-pipe-in-component-templates-c956c8c0c794 which looks at subscribe vs async pipe.
However even after studying this article and one's such as these on whether to subscribe or not I still am finding it hard to get a definite answer.
So I know that your subscription to a service can leak and according to this article if you are going to use subscribe() then you should unsubscribe() during ngOnDestroy().
Otherwise this will happen:
The subscription is never unsubscribed, so if the Observable does not complete on its own, that whole component, and its template and all their associated objects, will live in memory forever.
However I have also seen sometimes people say you do not need to explicitly unsubscribe when calling a service in a component because Angular does it for you? Maybe I am confusing myself but all I want is a definite answer so I know what to implement when using subscribe() so that memory leaks will not be a problem.
So do I need to explicitly unsubscribe() from a service in my component? An explanation would help future people as well if possible. Thank you!