In many apps you need to initialize the application from reading data from here and there (http, storage etc) and keep a global state. That single use “data loader” service is run once.
Ideally the resources (i.e. memory) it occupies should be removed. This might have a simple answer but I want to learn the correct way.
Thank you in advance…
Don’t sweat this, especially on mobile devices. Your code lives in a garbage-collected world. You do need to unsubscribe subscriptions you make, but don’t worry about the lifecycle of DI-managed objects (aka “things you inject in constructors”). Angular manages what it can, within the constraints of what the OS allows it to.
@rapropos That’s very comforting to hear, thank you.