Make angular.forEach wait for promise after going to next object

前端 未结 7 1930
囚心锁ツ
囚心锁ツ 2020-12-03 03:25

I have a list of objects. The objects are passed to a deferred function. I want to call the function with the next object only after the previous call is resolved. Is there

7条回答
  •  天命终不由人
    2020-12-03 04:11

    I use a simple solution for a connection to a printer that wait till the promise is over to go to the next.

    angular.forEach(object, function(data){
        yourFunction(data)
        .then(function (){
            return;
        })
    })
    

提交回复
热议问题