The AngularJS $cookies service is used to read, write and delete browser cookies. The cookie feature is available in angular-cookies.min.js file.
Here is a list of AngularJS $cookies methods with description.
Methods | Description |
---|---|
get(key) | This method returns the value of given cookie key. Where key is id of lookup cookie. |
getObject(key) | This method returns the deserialized value of given cookie key. Where key is id of lookup cookie. |
put(key, value, [options]) | This method is used to set a value for given key. Where key is id for value, value is raw value to be store and option is an object. |
putObject(key, value, [options]) | This method serializes and sets a value for given cookie key. Where key is id for value, value is raw value to be store and option is an object. |
getAll() | This method returns a key value object with all the cookies. |
remove(key, [options]) | This method is used to remove given cookie. Where key is id of cookie value, and option is an object. |
Syntax