I am trying to use the $ cookies service using angular 1.4.0-beta.2.
The cookie created by the server goes to document.cookie as well as to $cookies . but $cookies are just a simple object. when I check console.dir($cookies) there are only keys / values โโinside. where get() , put() , getAll() functions?
I tried to check the simplest code example from https://docs.angularjs.org/api/ngCookies/service/ $ cookies
angular.module('cookiesExample', ['ngCookies']) .controller('ExampleController', ['$cookies', function($cookies) { // Retrieving a cookie var favoriteCookie = $cookies.get('myFavorite'); // Setting a cookie $cookies.put('myFavorite', 'oatmeal'); }]);
but that will not work. This is probably trivial, but what am I missing?
angularjs cookies
yaron hochman
source share