DEV Community

Discussion on: Things to watch out for when using HMR with Angular

Collapse
 
dzhavat profile image
Dzhavat Ushev This is Angular

There's no problem with that. Services have ngOnDestroy hook as well. You can use it for clean up. coryrylan.com/blog/using-ngondestr...

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen This is Angular

That's good advice. Just don't try to use ngOnInit. It doesn't work for services. Instead, use the service constructor or an Angular initializer.