code: function (key, value) {
  
        // If this browser does not support local storage use cookies
        if (!browserSupportsLocalStorage || self.storageType === 'cookie') {
          if (!browserSupportsLocalStorage) {
              $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');
          }
  
          if (notify.setItem) {
            $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'});
          }
          return addToCookies(key, value);
        }
  
        // Let's convert undefined values to null to get the value consistent
        if (typeof value === "undefined") {
          value = null;
        }
  
        try {
          if (angular.isObject(value) || angular.isArray(value)) {
            value = angular.toJson(value);
          }
          if (webStorage) {webStorage.setItem(deriveQualifiedKey(key), value)};
          if (notify.setItem) {
            $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType});
          }
        } catch (e) {
          $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);
          return addToCookies(key, value);
        }
        return true;
      }
docs: Directly adds a value to local storage If local storage is not available in the browser use cookies Example use: localStorageService.add('library','angular');