This is my plunk:
https://plnkr.co/edit/SzaI1ffiCxFk7BE3Ke8o?p=preview
As you can see, my app gets data from an HTTP service. These data are shared between the components of an angular router.
The question is, I definitely don't want every component to load data from the http service everytime it is initialized (inside OnNgInit
method).
My app should instead load data from http service just at the beginning (and that's why I put the service PlanService.loadData()
inside OnNgInit
method of AppComponent
), and save them inside a local instance of the Object Plan. Then every component should get those data (in their initialization phase) from a service PlanService.getData()
.
I tried to do this, but without success.
Is there a different approach?