title: AngularJS $http.post inside function
body: <p>I am using AngularJS and inside a service I have this:</p>
  
  <pre><code>var fn = {
      test: function() {
          $http.post(...)
          .success(function(response) {
              console.log(response);
              return response;
          })
      }
  }
  
  this.testPostCall = function (id) {
     console.log(fn.test());
  };
  </code></pre>
  
  <p>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.</p>
  
  <p>Do you know why is undefined inside the controller ?
  Thanks </p>