title: Two promises inside a hash in $q.all
body: <p>I'm trying to make two API calls in parallel using <code>$q.all</code>, and return both of their responses as one to the controller, and when I break on the return lines for each promise inside the hash, they return the expected data, but it all seem to break when it reaches <code>$q.all</code>. This is all in a <a href="https://github.com/angular-ui/ui-router" rel="nofollow">ui-router</a> state, and I'm using resolve to supposedly provide the corresponding controller with the data from <code>$q.all</code></p>
  
  <p>It was originally written in Coffeescript, but here it is in Javascript:</p>
  
  <pre><code>      resolve: {
      content: [
        'APIService', function($q, $timeout, APIService) {
          var firstPromise, secondPromise, promises;
          firstPromise = $q.defer();
          secondPromise = $q.defer();
          promises = {
            firstPromise: APIService.get('/some/api/call').then(function(response) {
              return response;
            }),
            secondPromise: APIService.get('/another/api/call').then(function(response) {
              return response;
            })
          };
          $.blockUI();
          $timeout(function() {
            firstPromise.resolve('firstPromise');
            secondPromise.resolve('secondPromise');
          }, 1000);
          $q.all(promises).then(function(responses) {
            $.unblockUI();
            return responses;
          });
          return false;
        }
      ]
    }
  </code></pre>
  
  <p>Please help? I'm using Angular 1.3.15</p>