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.
.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 }
   })
I know that Object { $$state: Object } means, that the Object could not be resolved in time. But how can i do this?
