I'm creating a webapp with MEAN stack. In the backend, I have implemented an http get at: "http://localhost:8080/users/friends/" It works, because I have tried it with Postman and CURL. It returns an array of objects (it returns an array with all the elements of the collection "friends" in the server.
However, in the frontend I have a service with the following function:
this.getFriends = function() {
var q = $q.defer();
$http.get("http://localhost:8080/users/friends/")
.then(
function(friends) {
q.resolve(friends);
},
function(err) {
q.reject(err);
}
);
return q.promise;
}
If I log it, it prints "object Object". The rest of the service is working.
strigified
json.. doconsole.log(friends)
inside your$http.get
success