I have implemented the $q.all in angularjs, but I can not make the code work. Here is my code :
UploadService.uploadQuestion = function(questions){
        var promises = [];
        for(var i = 0 ; i < 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);
    }
And here is my controller which call the services:
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
})
I think there is some problem setting up $q.all in my service.
 
     
     
     
     
    