I'm trying to use the $cookies service using angular 1.4.0-beta.2.
The cookie created by the server gets into document.cookie
and also into $cookies
.
but $cookies
is just a simple object.
when I check console.dir($cookies)
there's only keys/values inside.
where's the get()
, put()
, getAll()
functions?
I've tried to check the very basic sample code 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 it doesn't work. It's probably trivial, but what am I missing?
did you remember to update "angular-cookies" too? it's a plugin, so updating "angular" alone won't work.
I'm using 1.4.0-rc.1, and it works (having updated "angular-cookies" to "1.4.0-rc.1", of course)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With