In your interface - you should make getAll
is a promise. You need to use .then
to access its content:
contacts_helper.getAll().then(function(response){
console.log(response);
}]);
This is possible, by changing getAll
to return the http call.
this.getAll = function(){
return $http({
method:'GET',
url:'http://facebook.com',
params:{id_user:$rootScope.session.id_user}
}).success(function(response){
return response;
}).error(function(err){
return false;
});
};
Or even simpler:
this.getAll = function(){
return $http({
method:'GET',
url:'http://facebook.com',
params:{id_user:$rootScope.session.id_user}
});
};
Also, you should probably read How do I return the response from an asynchronous call?