angularJS 使用$cookies的時候,如何設定cookie的儲存時間
我是答案的搬運工:http://stackoverflow.com/questions/12624181/angularjs-how-to-set-expiration-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}); }]);
我是答案的搬運工:
http://stackoverflow.com/questions/12624181/angularjs-how-to-set-expiration-date-for-cookie-in-angularjs