angularJS 在使用$cookies的时候,如何设置cookie的保存时间
Saya adalah porter jawapan: http://stackoverflow.com/questions/12624181/angularjs-how-to-set-expired-date-for-cookie-in-angularjs
angular.module('cookiesExample', ['ngCookies']) .controller('ExampleController', ['$cookies', function($cookies) { // Find tomorrow's date. var expireDate = new Date(); expireDate.setDate(expireDate.getDate() + 1); // Setting a cookie $cookies.put('myFavorite', 'oatmeal', {'expires': expireDate}); }]);
Saya adalah porter jawapan:
http://stackoverflow.com/questions/12624181/angularjs-how-to-set-expired-date-for-cookie-in-angularjs