Sep 12, 2021
Yes indeed you can use ngOnDestroy
in services but be careful with it. It is called when the related app, module or component to which the service is provided in is destroyed. In the dummy example of this article, as the service is provided: 'root'
the destroy would only be called when the all app is destroyed.