I have a problem in controller with the properties of object. My factory return one object with another object and one function. I can call the function but i can't access in another object properties. Here is my code:
My factory
app.factory('User', function () {
var User = {};
User.get = function () {
// Call the service... done
User.data = response.data;
};
return User;
});
My controller
app.controller('Controller', function ($scope, User) {
$scope.user = User;
console.log(user); // print correct one object with
the function get and data object with user data
console.log(user.data); // undefined
});
Thanks, and sorry for my english disaster