Improve this Doc View Source $cookieStore
- service in module ngCookies
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
Methods
-  get(key);Returns the value of given cookie key ParametersParam Type Details key stringId to use for lookup. ReturnsObjectDeserialized cookie value. 
-  put(key, value);Sets a value for given cookie key ParametersParam Type Details key stringId for the value.value ObjectValue to be stored. 
-  remove(key);Remove given cookie ParametersParam Type Details key stringId of the key-value pair to delete. 
angular.module('cookieStoreExample', ['ngCookies'])
.controller('ExampleController', ['$cookieStore', function($cookieStore) {
  // Put cookie
  $cookieStore.put('myFavorite','oatmeal');
  // Get cookie
  var favoriteCookie = $cookieStore.get('myFavorite');
  // Removing a cookie
  $cookieStore.remove('myFavorite');
}]);
 
    © 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
    https://code.angularjs.org/1.2.32/docs/api/ngCookies/service/$cookieStore