title: Use a async function from the angularjs factory
body: <p>I want to use the first customer of my customers in my Controller, but its not working. What i want is to retrieve my first customer in a factory service and then use it in my Controller.</p>
  
  <pre><code>.factory("CustomerService", ["$resource", function($resource) {
        return $resource('js/customers.json');
     }])
  
     .factory("FirstCustomer", ["CustomerService", function(CustomerService) {
        var customer;
        customer = CustomerService.query().$promise.then(function(info) {
           console.log(info[0]); // This works
           return info[0];
        });
        console.log(customer); //This doesnt
        return {
           value: customer
        };
     }])
  
     .controller('CustomerController', function($scope, FirstCustomer) {
        $scope.customer = FirstCustomer.value;
        console.log($scope.customer); // Shows Object { $$state: Object }
     })
  </code></pre>
  
  <p>I know that <code>Object { $$state: Object }</code> means, that the Object could not be resolved in time. But how can i do this?</p>