$cookies - This service provides read/write access to browser's cookies.
If you want to use existing cookie solution, say read/write cookies from your existing server session system then
use $cookie.
var app=angular.module('cookiesExample', ['ngCookies']);
app.controller('ExampleController', function ($cookies) {
// Retrieving a cookie
var favoriteCookie = $cookies.myFavorite;
// Setting a cookie
$cookies.myFavorite = 'meal';
});
$cookiesStore - $cookieStore is a thin wrapper around $cookies. It provides a key-value (string-object) storage
that is backed by session cookies. The objects which are put or retrieved from this storage are automatically
serialized or deserialized by angular to JSON and vice versa.
If you are creating a new solution which will persist cookies based on key/value pairs, use $cookieStore.
var app=angular.module('cookieStoreExample', ['ngCookies']);
app.controller('ExampleController',function ($cookieStore) {
// Put cookie
$cookieStore.put('myFavorite', 'meal');
// Get cookie
var favoriteCookie = $cookieStore.get('myFavorite');
// Removing a cookie
$cookieStore.remove('myFavorite');
});