View source Improve this doc

$cookieStore

service in module ngCookies

Description

Provides a key-value (string-object) storage, that is backed by session cookies. Objects put or retrieved from this storage are automatically serialized or deserialized by angular's toJson/fromJson.

Requires the ngCookies module to be installed.

Dependencies

  • $cookies

Methods

  • get(key)

Returns the value of given cookie key

Parameters

ParamTypeDetailskeystring

Id to use for lookup.

Returns

Object

Deserialized cookie value.

  • put(key, value)

Sets a value for given cookie key

Parameters

ParamTypeDetailskeystring

Id for the value.

valueObject

Value to be stored.

  • remove(key)

Remove given cookie

Parameters

ParamTypeDetailskeystring

Id of the key-value pair to delete.

Example