Reputation: 619
I need a clue. How can I store data downloaded from the API?
All data downloading functions can be found in Service
I have several components
Where should this data be saved so that other components can use it?
If I return a value in the component in which the button was pressed from the data retrieval function, then only in this component I will have this data.
Upvotes: 1
Views: 61
Reputation: 891
You can use Web Storage (Session storage and Local storage), but it depends on size of data. Local Storage and Session storage can store up to 10 MB i think, bit if your data size is much bigger , reconsider using IndexedDB. Here is a link to read: https://developers.google.com/web/ilt/pwa/working-with-indexeddb
Upvotes: 0
Reputation: 1425
My suggestion is to save it in LocalStorage, but it depends based on your needs.
Check this one if it helps: Angular 6: saving data to local storage
LocalStorage is very well supported on different browsers: https://caniuse.com/#search=localstorage
Upvotes: 1