Interface CookieService


@JsType(isNative=true, name="ng.CookieService", namespace="<global>") public interface CookieService
High-level API for reading, writing, serializing, and removing browser cookies through the injectable `$cookie` service.
  • Method Details

    • get

      String get(String key)
      Retrieves a raw cookie value.
      Parameters:
      key - Cookie name to read.
      Returns:
      Method result.
    • getAll

      jsinterop.base.JsPropertyMap<String> getAll()
      Returns an object containing all raw cookies.
      Returns:
      Method result.
    • getObject

      Object getObject(String key)
      Retrieves a cookie and deserializes its JSON content.
      Parameters:
      key - Cookie name to read.
      Returns:
      Method result.
    • put

      void put(String key, String value, CookieOptions options)
      Sets a raw cookie value.
      Parameters:
      key - Cookie name to write.
      value - String value to write.
      options - Cookie attributes for this write.
    • putObject

      void putObject(String key, Object value, CookieOptions options)
      Serializes an object as JSON and stores it as a cookie.
      Parameters:
      key - Cookie name to write.
      value - JSON-serializable value.
      options - Cookie attributes for this write.
    • remove

      void remove(String key, CookieOptions options)
      Removes a cookie by setting an expired date.
      Parameters:
      key - Cookie name to remove.
      options - Cookie attributes that must match the existing cookie.