Handling for explicit usage of cookie fallback

If the user explicitely set the storage type to cookie also the
getFromLlocalStorage and addToLocalStorage method should use the cookie
fallback.
revert-117-master
Sebastian Gronewold 10 years ago
parent 7ef86fb4a5
commit e7c465c898

@ -121,7 +121,7 @@ angularLocalStorage.provider('localStorageService', function() {
var addToLocalStorage = function (key, value) {
// If this browser does not support local storage use cookies
if (!browserSupportsLocalStorage) {
if (!browserSupportsLocalStorage || this.storageType === 'cookie') {
$rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');
if (notify.setItem) {
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'});
@ -153,7 +153,7 @@ angularLocalStorage.provider('localStorageService', function() {
// Example use: localStorageService.get('library'); // returns 'angular'
var getFromLocalStorage = function (key) {
if (!browserSupportsLocalStorage) {
if (!browserSupportsLocalStorage || this.storageType === 'cookie') {
$rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED');
return getFromCookies(key);
}