title: Angular js - return and console.log $http response from outside the method
body: <p>Hi my code is very simple but i can't get to log the http result to this:</p>
  
  <pre><code>var app = angular.module('app', ['ngRoute']);
  
  app.run(['contacts_helper','$rootScope', function(contacts_helper,$rootScope){
      var x = contacts_helper.getAll();
      console.log(x); // returns undefined 
    }]);
  
  app.service('contacts_helper',['$http','$rootScope', function($http,$rootScope){
  
    this.getAll = function(){
  
      $http({
      method:'GET',
      url:'http://localhost/myjson.json',
      params:{id_user:$rootScope.session.id_user}
  
      }).success(function(response){
  
       return response;
  
      }).error(function(err){
  
       return false;
  
      });
  
  
      }
  
  
  }]);
  </code></pre>
  
  <p>it always return <code>undefined</code> in console</p>
  
  <p>So how to achieve this?</p>