David Dal Busco
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.

--

--

David Dal Busco
David Dal Busco

Written by David Dal Busco

Freelancer by day | Creator of Juno.build by night

No responses yet