Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228598

$localstorage doesn't work on Android device

$
0
0

A very late reply, but maybe some people having the same problem would benefit from it :slightly_smiling:

Android is more picky than Chrome, so in Chrome when you declare an Object, and push data to it, it is ok.
In Android it is not.

So you should declare an array [] in stead of an object {}

So initial declaration:
$scope.favorite = [];

Getting it from local storage:
$localStorage.getObject('favorite', '[]');

And then you can push...
favorite.push({id: index});


Viewing all articles
Browse latest Browse all 228598

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>