Skip to content

Commit 7493cd8

Browse files
committed
fix(localStorageService): fix cookie serialization(object/array) issue: #121
1 parent 44575f4 commit 7493cd8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/angular-local-storage.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(function() {
2-
/* Start angularLocalStorage */
31
'use strict';
42
var angularLocalStorage = angular.module('LocalStorageModule', []);
53

@@ -286,6 +284,8 @@ angularLocalStorage.provider('localStorageService', function() {
286284

287285
if (typeof value === "undefined") {
288286
return false;
287+
} else if(angular.isArray(value) || angular.isObject(value)) {
288+
value = angular.toJson(value);
289289
}
290290

291291
if (!browserSupportsCookies()) {
@@ -427,4 +427,3 @@ angularLocalStorage.provider('localStorageService', function() {
427427
};
428428
}];
429429
});
430-
}).call(this);

0 commit comments

Comments
 (0)