sessionStorage not work in device


#1

I’m keeping in session one json arrangement until it’s all right here in the evidence do in the browser everything works fine but the device does not work, saved session. I’m keeping this:

.factory('sessionService',['$http',function($http){
 return {
     set:function(key,value){
        return sessionStorage.setItem(key,JSON.stringify(value));
     },
     get:function(key){
        return JSON.parse(sessionStorage.getItem(key));
     },
     destroy:function(key){
        return sessionStorage.removeItem(key);
     },
   };
}])

#2

Instead of sessionStorage you can use localStorage for device. I will work exactly like sessionStorage


#3

I used localStorage but facing same problem again…can’t get device id using window.localstorage and sessionStorage


#4

You can set localstorage like
to set : localStorage["key"] =value;
to get : var data = localStorage["key"];

for session storage you can use ngStorage.min.js module with $sessionStorage