From fd2fc272faa4c2a3feb60d8d9cadf1e34859272d Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Mon, 6 Oct 2014 23:34:51 +0300 Subject: [PATCH] fix(localStorageService): serialization numbers , issue #99 --- src/angular-local-storage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/angular-local-storage.js b/src/angular-local-storage.js index 76c01fe..f40c260 100644 --- a/src/angular-local-storage.js +++ b/src/angular-local-storage.js @@ -118,7 +118,7 @@ angularLocalStorage.provider('localStorageService', function() { // Let's convert undefined values to null to get the value consistent if (typeof value === "undefined") { 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); } @@ -168,7 +168,7 @@ angularLocalStorage.provider('localStorageService', function() { return null; } - if (item.charAt(0) === "{" || item.charAt(0) === "[") { + if (item.charAt(0) === "{" || item.charAt(0) === "[" || angular.isNumber(+item || item)) { return angular.fromJson(item); }