fix(localStorageService): serialization numbers , issue #99

master
Ariel Mashraki 10 years ago
parent 4b25996bac
commit fd2fc272fa

@ -118,7 +118,7 @@ angularLocalStorage.provider('localStorageService', function() {
// Let's convert undefined values to null to get the value consistent // Let's convert undefined values to null to get the value consistent
if (typeof value === "undefined") { if (typeof value === "undefined") {
value = null; value = null;
}else if (angular.isObject(value) || angular.isArray(value)) { } else if (angular.isObject(value) || angular.isArray(value) || angular.isNumber(value)) {
value = angular.toJson(value); value = angular.toJson(value);
} }
@ -168,7 +168,7 @@ angularLocalStorage.provider('localStorageService', function() {
return null; return null;
} }
if (item.charAt(0) === "{" || item.charAt(0) === "[") { if (item.charAt(0) === "{" || item.charAt(0) === "[" || angular.isNumber(+item || item)) {
return angular.fromJson(item); return angular.fromJson(item);
} }