javascript - i am storing an array in sessionstorage and retrieving through sessionstorage. I am getting the data but i am unable to repeat the array -
var x=[ { "xyz":1, "abc":"dashboard", "def":0, }, { "xyz":2, "abc":"facility", "def":0 }]
this original data.then storing data using session storage below---
$window.sessionstorage.setitem("useritems", json.stringify(x));
then retrieving data using sessionstorage---
$window.sessionstorage.getitem("useritems")
i getting data correctly--
[{ "xyz":1, "abc":"dashboard", "def":0, }, { "xyz":2, "abc":"facility", "def":0 }]
but unable repeat data , displaying data.
you need wrap json.parse() :
json.parse($window.sessionstorage.getitem("useritems"));
Comments
Post a Comment