diff --git a/angular-local-storage.js b/angular-local-storage.js index 0a8ee3f..8ebbe0b 100644 --- a/angular-local-storage.js +++ b/angular-local-storage.js @@ -75,6 +75,10 @@ angularLocalStorage.provider('localStorageService', function() { // When Angular's $document is not available if (!$document) { $document = document; + } else { + // unwrapping the jquery encapsulated document to access cookies + // (see http://www.bennadel.com/blog/2630-accessing-document-properties-in-angularjs.htm) + $document = $document[0]; } // If there is a prefix set in the config lets use that with an appended period for readability