This answer is just for the case you have mentions, i.e a http request for a get method.
In the official site of angular https://angular.io/guide/observables you ll find a sentence written like this "The subscribed consumer then receives notifications until the function completes, or until they unsubscribe.". It means the subscribe method got unsubscribe by angular itself when it gets completed.
To execute the observable you have created and begin receiving notifications, you call its subscribe() method, passing an observer. This is a JavaScript object that defines the handlers for the notifications you receive. The subscribe() call returns a Subscription object that has an unsubscribe() method, which you call to stop receiving notifications.
The above explanation shows that you have an extra advantage of unsubscribe() method to unsubscribe you subscription according to ur conditions. but it's never mandatory to unsubscribe before using it again.
Now when i come to your code you are unsubscribing it in ngOnDestroy which says "This is the time to notify another part of the application that the component is going away.".Already all the ongoing subscriptions related to this component is aborted by angular with the change in component.
So There is no meaning of asking to unsubscribe in the ngOnDestroy() method.
And if i ll focus on the http method, this is the explaination found in the [https://angular.io/guide/http].
An HttpClient method does not begin its HTTP request until you call subscribe() on the observable returned by that method. The AsyncPipe subscribes (and unsubscribes) for you automatically.
The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted. When a new value is emitted, the async pipe marks the component to be checked for changes. When the component gets destroyed, the async pipe unsubscribes automatically to avoid potential memory leaks.
Some common cases where we use unSubscribe() usually
- To clear the timeout to stop execution
- Remove something from the observers array so it will no longer be notified and many more.
But yes, In some cases you may need to unsubscribe your subscription in the ngOnDestroy() method. But not needed here.
Go through all the examples from the link i have provided. It may help you better. Hope i helped a bit.