var YourCtrl = function($scope, localStorageService, ...) {
  // To add to local storage
  localStorageService.set('localStorageKey','Add this!');
  // Read that value back
  var value = localStorageService.get('localStorageKey');
  // To remove a local storage
  localStorageService.remove('localStorageKey');
  // Removes all local storage
  localStorageService.clearAll();
  // You can also play with cookies the same way
  localStorageService.cookie.set('localStorageKey','I am a cookie value now');
}


我的angular实例
localStorage.setItem('localStorageKey','Example');
var sign = localStorage.getItem('localStorageKey');
alert(sign);
posted on 2017-01-03 16:34  happiness木木  阅读(6953)  评论(0编辑  收藏  举报