I updated from angular 1.2 (source code) recently to 1.3 (which violated cookies) to 1.4 today ($ cookieStore is now deprecated due to $ cookies)
I added a line $cookies.putObject('user', user);, but it is not saved in cookies (I checked on the chrome resources tab)
login: function (user, callback) {
var cb = callback || angular.noop;
return Session.save({
email: user.email,
password: user.password
}, function (user) {
$rootScope.currentUser = user;
$cookies.putObject('user', user);
return cb();
}, function (err) {
return cb(err);
}).$promise;
},
I set a breakpoint right after $cookies.putObject, and I get undefinedwhen I try $cookies.getObject('user')in the Chrome console.
This is a problem because now, when I refresh the page, I am losing the registered user. The service Auth.jshas this line in front:
$rootScope.currentUser = $cookies.getObject('user') || null;
source
share