$scope.listDocuments;
$scope.promises[];
angular.forEach(values, function($scope.listDocuments, document) {
    
    
promises.push(myService.downloadDocument(document.url).then(function(document)
    {
        console.debug(document.name);
        
    }).catch(error)
    {
        console.debug(document.name);

    });
        

}


             $q.all(promises);
    
}


myService.downloadDocument{
  var deferred = $q.defer();
$http
    .get('http://download/document')
    .then(function(response) {
      deferred.resolve(response.data);

      }).catch(function(error) {
              deferred.reject(err);
    });
    
}

the problem is , i have service to download many documents, but when a 
document is failure i want to recover his name in catch 
console.debug(document.name) i recover only last document in list not 
document that are failure. I think , the problem is not in service but in 
how i call service in foreach.
have you any idea..?

On Friday, January 17, 2020 at 10:16:59 AM UTC+1, Sander Elias wrote:
>
> Hi Samir,
>
> Yes!
> That is an answer, I'm not sure about your question, so it might even be a 
> fitting answer ☺
> Perhaps you can share some code, so it is more clear what you are asking?
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/f137012e-2967-46d6-818b-7a992e5f8dd9%40googlegroups.com.

Reply via email to