I am using AngularJS and inside a service I have this:
var fn = {
    test: function() {
        $http.post(...)
        .success(function(response) {
            console.log(response);
            return response;
        })
    }
}
this.testPostCall = function (id) {
   console.log(fn.test());
};
In the controller testPostCall is undefined, in fact in the console the first output that I get is undefined and the second one is the correct JSON response.
Do you know why is undefined inside the controller ? Thanks
 
     
     
    