I'm storing a user object on a Cookie and, when the client visit the site again, I want to use this object's properties.
But, when the client comes back, my cookie object looks like [object object]  while it's properties looks like undefined.
Here is my code:
$scope.signup = function (user) {
    $http.post('/api/signup', user)
        .then( function (res) {
            $cookies.put('user', res.data.user); //This is where I store my cookie.
        }, function (res) {
        });
};
When the client comes back, I have this code:
var lastUser = $cookies.get('user');
if (lastUser) $scope.lastName = lastUser.username;
console.log(lastUser);  // [object object]
console.log(lastName); // undefined
What can I do to properly get the cookie info?
 
    