From d9014d21de257d04f9c986dbee9e42f22f33fdfc Mon Sep 17 00:00:00 2001 From: dcendents Date: Thu, 8 Aug 2013 10:43:45 -0400 Subject: [PATCH 1/3] Fix code to run in Internet Explorer where the method key throws an error instead of returning null when the specified key does not exist. --- ngStorage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ngStorage.js b/ngStorage.js index baca0fe..511e599 100644 --- a/ngStorage.js +++ b/ngStorage.js @@ -59,7 +59,8 @@ }, _last$storage; - for (var i = 0, k; k = webStorage.key(i); i++) { + for (var i = 0, k; i < webStorage.length; i++) { + k = webStorage.key(i) 'ngStorage-' === k.slice(0, 10) && ($storage[k.slice(10)] = angular.fromJson(webStorage.getItem(k))); } From 14b87a294e7ece9c75871c421e4d07ac5a9028bf Mon Sep 17 00:00:00 2001 From: dcendents Date: Thu, 8 Aug 2013 11:02:20 -0400 Subject: [PATCH 2/3] fixing syntax --- ngStorage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngStorage.js b/ngStorage.js index 511e599..d440811 100644 --- a/ngStorage.js +++ b/ngStorage.js @@ -60,7 +60,7 @@ _last$storage; for (var i = 0, k; i < webStorage.length; i++) { - k = webStorage.key(i) + k = webStorage.key(i); 'ngStorage-' === k.slice(0, 10) && ($storage[k.slice(10)] = angular.fromJson(webStorage.getItem(k))); } From 8b7a7bed9ac8750cf0719976021d90210fe36ff3 Mon Sep 17 00:00:00 2001 From: dcendents Date: Thu, 8 Aug 2013 12:57:00 -0400 Subject: [PATCH 3/3] Changing the format as requested --- ngStorage.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ngStorage.js b/ngStorage.js index d440811..26b0ca8 100644 --- a/ngStorage.js +++ b/ngStorage.js @@ -59,8 +59,7 @@ }, _last$storage; - for (var i = 0, k; i < webStorage.length; i++) { - k = webStorage.key(i); + for (var i = 0, k; i < webStorage.length && (k = webStorage.key(i)); i++) { 'ngStorage-' === k.slice(0, 10) && ($storage[k.slice(10)] = angular.fromJson(webStorage.getItem(k))); }