title: Angularjs $q.all
body: <p>I have implemented the $q.all in angularjs, but I can not make the code work. Here is my code :</p>
  
  <pre><code>UploadService.uploadQuestion = function(questions){
  
          var promises = [];
  
          for(var i = 0 ; i &lt; questions.length ; i++){
  
              var deffered  = $q.defer();
              var question  = questions[i]; 
  
              $http({
  
                  url   : 'upload/question',
                  method: 'POST',
                  data  : question
              }).
              success(function(data){
                  deffered.resolve(data);
              }).
              error(function(error){
                  deffered.reject();
              });
  
              promises.push(deffered.promise);
          }
  
          return $q.all(promises);
      }
  </code></pre>
  
  <p>And here is my controller which call the services:</p>
  
  <pre><code>uploadService.uploadQuestion(questions).then(function(datas){
  
     //the datas can not be retrieved although the server has responded    
  }, 
  function(errors){ 
     //errors can not be retrieved also
  
  })
  </code></pre>
  
  <p>I think there is some problem setting up $q.all in my service.</p>