AngularTS
    Preparing search index...

    Class CookieService

    High-level API for reading, writing, serializing, and removing browser cookies through the injectable $cookie service.

    Index

    Constructors

    Methods

    • Retrieves a raw cookie value.

      Parameters

      • key: string

        Cookie name to read.

      Returns string | null

      The decoded cookie value, or null when not set.

      – If decodeURIComponent fails.

    • Returns an object containing all raw cookies.

      Returns Record<string, string>

      – If decodeURIComponent fails

    • Retrieves a cookie and deserializes its JSON content.

      Parameters

      • key: string

        Cookie name to read.

      Returns unknown

      The parsed value, or null when not set.

      if cookie JSON is invalid

    • Sets a raw cookie value.

      Parameters

      • key: string

        Cookie name to write.

      • value: string

        String value to write.

      • options: CookieOptions = {}

        Cookie attributes for this write.

      Returns void

      if key or value cannot be encoded

    • Serializes an object as JSON and stores it as a cookie.

      Parameters

      • key: string

        Cookie name to write.

      • value: unknown

        JSON-serializable value.

      • Optionaloptions: CookieOptions

        Cookie attributes for this write.

      Returns void

      if Object cannot be converted to JSON

    • Removes a cookie by setting an expired date.

      Parameters

      • key: string

        Cookie name to remove.

      • options: CookieOptions = {}

        Cookie attributes that must match the existing cookie.

      Returns void