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);