I'm building a website with Angular 6 and making multiple webservices requests in order to get data. So I thought I must load the data once and save it somewhere.
Currently I'm saving the data that I get from webservices to local storage (code below), I'm giving the users the possibility to delete the local storage through a refresh button.
Is there any better way (that works with Angular 6) to save data in the browser, and speed navigation ?
my solution was to insert the code below in app.module.ts and then get and set data in the local storage
export function getLocalStorage() {
return (typeof window !== "undefined") ? window.localStorage : null;;
}
Aucun commentaire:
Enregistrer un commentaire