I am developing an app in M.E.A.N stack. I'm using an angular controller (from a directive), and a service. The controller calls the service, the service sends a GET request to NodeJS and gets a result. Then I log the result in the service and I get the data.
The problem is that the controller also logs the service before the controller gets results.
In services.js:
var self = this;
self.show = function() {
$http.get('/contactlist').success(function(response) {
console.log(response);
return response;
});
In directives.js:
this.contacts = contactsSrv.show();
console.log(this.contacts);
And that's what I see in the console:

(The directive logs before it gets results from contactsSrv.show())
How can I make the contactsSrv.show() asynchronous?
Thanks!