title: Accessing a variable inside a Factory's callback function outside of it in angular
body: <p>My Factory looks like this:</p>
  
  <pre><code>.factory('MyFactory', function(){
      return: {
           someFunction: functon(firstParam, secondParam, resultObject) {
                       $http.get(url).success(resultObject);
          }     
      }
  })
  </code></pre>
  
  <p>My controller looks like this:</p>
  
  <pre><code>.controller('MyCtrl', function($scope) {
      MyFactory.someFunction(paramOne, paramTwo, function(resultObj) {
            $scope.result = resultObj;
            console.log($scope.result) //has the object
       });
      console.log($scope.result) //undefined
  }):
  </code></pre>
  
  <p>I'd like <code>$scope.result</code> to be available inside the controller and not just within the callback. Right now its only available within the callback function.</p>
  
  <p>I understand what the problem is here, that the scope of the variable inside the callback function ends within the function, I just don't understand how to overcome this.</p>