code: function (key, value) {
  
        if (typeof value === "undefined") {
          return false;
        }
  
        if (!browserSupportsCookies()) {
          $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED');
          return false;
        }
  
        try {
          var expiry = '',
              expiryDate = new Date(),
              cookieDomain = '';
  
          if (value === null) {
            // Mark that the cookie has expired one day ago
            expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000));
            expiry = "; expires=" + expiryDate.toGMTString();
            value = '';
          } else if (cookie.expiry !== 0) {
            expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000));
            expiry = "; expires=" + expiryDate.toGMTString();
          }
          if (!!key) {
            var cookiePath = "; path=" + cookie.path;
            if(cookie.domain){
              cookieDomain = "; domain=" + cookie.domain;
            }
            $document.cookie = deriveQualifiedKey(key) + "=" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain;
          }
        } catch (e) {
          $rootScope.$broadcast('LocalStorageModule.notification.error',e.message);
          return false;
        }
        return true;
      }
docs: Directly adds a value to cookies Typically used as a fallback is local storage is not available in the browser Example use: localStorageService.cookie.add('library','angular');