©
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Provides read/write access to browser's cookies.
Only a simple Object is exposed and by adding or removing properties to/from this object, new cookies are created/deleted at the end of current $eval. The object's properties can only be strings.
Requires the ngCookies
module to be installed.
angular.module('cookiesExample', ['ngCookies'])
.controller('ExampleController', ['$cookies', Function($cookies) {
// Retrieving a cookie
var favoriteCookie = $cookies.myFavorite;
// Setting a cookie
$cookies.myFavorite = 'oatmeal';
}]);