|
|
@ -52,6 +52,9 @@ angularLocalStorage.service('localStorageService', [
|
|
|
|
if (typeof value == "undefined") value = null;
|
|
|
|
if (typeof value == "undefined") value = null;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (angular.isObject(value)) {
|
|
|
|
|
|
|
|
value = angular.toJson(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
localStorage.setItem(prefix+key, value);
|
|
|
|
localStorage.setItem(prefix+key, value);
|
|
|
|
if (notify.setItem) {
|
|
|
|
if (notify.setItem) {
|
|
|
|
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'localStorage'});
|
|
|
|
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'localStorage'});
|
|
|
@ -73,6 +76,9 @@ angularLocalStorage.service('localStorageService', [
|
|
|
|
|
|
|
|
|
|
|
|
var item = localStorage.getItem(prefix+key);
|
|
|
|
var item = localStorage.getItem(prefix+key);
|
|
|
|
if (!item) return null;
|
|
|
|
if (!item) return null;
|
|
|
|
|
|
|
|
if (item.charAt(0) === "{") {
|
|
|
|
|
|
|
|
return angular.fromJson(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
return item;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|