This question already has an answer here:
What is the best practice to store (and share) initial values in an Angular 2 application using a service? I have a service that loads much data from a server as resources,configurations and other that are array and objects. I do not want to load this data each time I load a component or when I route to a view, I just want to use these objects and array already loaded when the application starts, and optionally reload if needed. The question is where is the right place to store this values and how to share across components that use the service? Thanks.
Gunter is completely right regarding shared services!
Here are some more details for an HTTP that relies on observables and cached data for next calls:
You have to think about shared service and make sure only single instance is shared among components.
shared service and shared object demo
Note:
don't forget to register service in bootstrap function. Observe code deeply. you will get what you want. Routing part is not demonstrated. Surf plunk for further implementation
service.ts
The right place is definitely a service. If you add this service as provider at one place only, one instance is shared with the whole application. If you add it to providers on each component, each component gets its own instance - which is what you want to avoid