DEV Community

loading...

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

Collapse
dzhavat profile image
Dzhavat Ushev Author

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

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.