title: AngularJs $q.all not resolving with mixed, nested promises
body: <p>I have a function that needs to test an array of parameters for errors before proceeding. Depending on the item, the test may or may not involve a call to the server. </p>
  
  <p>I've implemented an array of $q's in order to ensure they all finish before evaluating the test results. I'm returning the array using $q.all. </p>
  
  <p>I know that all promises are resolving, because I can step through each one and see the resolution, but for some reason, the resolution is not reaching the topmost .then. </p>
  
  <p>Topmost .then:</p>
  
  <pre><code>$scope.BigTest().then(function(result){
   //examine the array of results &amp; then call the function we want to execute
   // we never ever reach here
  },
  function(error){
    // handle the error
    // we never ever reach here either
  });
  </code></pre>
  
  <p>the function using $q,all(): </p>
  
  <pre><code>$scope.BigTest = function(){
      var promises = new Array();
      for (var x = 0; x &lt; $scope.testingStuff.length; x ++){
          var temp = $q.defer();
          if ($scope.testingStuff[x].localTestingGoodEnough){
              if (test){
                  temp.resolve(true);
              }
              else{
                  temp.resolve(false);
              }
          }
          else{
              var getServerStuff = ServerService.testServer($scope.testingStuff[x]);
              getServerStuff.then(function(result){
                  // I've debugged through here and know this is successfully happening        whenever necessary, and that the value is appropriate
                  temp.resolve(result.value);
              },function(error){
                  temp.resolve(false);
              });
          }
          promises[x] = temp.promise;
      }
      return $q.all(promises);
  } 
  </code></pre>
  
  <p>As noted in the psuedocode, the problem is that the entire array of promises is never being resolved when the test requires a call to the server. </p>
  
  <p>In the cases where there is no server call required, the set resolves as expected.</p>
  
  <p>Any ideas as to why this is not resolving? Perhaps I'm not using $q.all() properly?</p>