Instead of returning an observable to the requesting components and managing the data, I am considering using Angular services to handle HTTP requests autonomously. The goal is to have components retrieve data directly from the service where it is stored.
The idea is that if the data is already loaded and up to date (loaded within the past minute), it can be quickly returned to the requesting component. If not, the service will load and store the data before providing it to the component.
Angular tutorials typically show services returning observables that components must subscribe to and manage the data themselves.
Does my approach seem logical?
In my current prototype, I have multiple components needing the same data, so loading it multiple times is inefficient. I am also trying to avoid using Redux or similar frameworks.
Can anyone provide an example of a service that handles HTTP requests internally and manages the data?
Thank you in advance.