Improve this doc  View Source

$cookieStore

  1. - 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

Example

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');
  }]);