Question

I would like to know if it was possible to retrieve the data from the localstorage/sessionStorage and display them in a template ?

I save my data like this :

localstorage["user.name"] = "username";
localstorage["user.email"] = "email";
[...]

And I do the same way for the sessionStorage. But I would like to use it to display those information in one of my template. And that would be update without being refresh.

For exemple, I have a table, and this table might have some data or row removed or add.

I found this adapter https://github.com/rpflorence/ember-localstorage-adapter but I'm not using ember-Data.

Should I use it ?

Was it helpful?

Solution

ember-localstorage-adapter works with Ember-Data. It writes and reads from local storage automatically. If you use that, you just need to create a DS.Model and set adapter for the store, you don't need to set values manually. If you do not prefer to use the adapter, you can load the data yourself in the model hook of the route.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top