Only one data store localStorage JSON data using AngularJS -


i have problem in store localstorage json feeds stores 1 data. when add more data, shows one. please me!

stored values

var fav_game = [{     id   : "1212",     name : "cricket"   }]; 

store localstorage data

window.localstorage['favgame'] = json.stringify(fav_game); var favgame = json.parse(window.localstorage['favgame'] || '{}'); 

get local storage items:

$scope.favgame = json.parse(localstorage.getitem('fav_game')) || []; console.log(localstorage['favgame']); 

var fav_game = [{ id : "1212", name : "cricket" }];  window.localstorage['favgame'] = json.stringify(fav_game);  function addvalue(key,val){    temp = [];    tmp = localstorage.getitem(key);    if(tmp != null){      temp.push(json.parse(tmp));      temp.push(val);      window.localstorage['favgame'] = json.stringify(temp)    }  }  addvalue('favgame','here valid data')


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -