multiple `.then()`s on single angularjs promise — all use _original_ data

前端 未结 2 1553
醉酒成梦
醉酒成梦 2020-12-29 01:19

I\'m writing an angularjs app relying on promises, and though it\'s working, I wonder if I could do it more optimally.

At the beginning of the code, I\'m creating a

2条回答
  •  悲哀的现实
    2020-12-29 01:50

    You need parallel execution: $q.all()

    $q.all(
        function1,
        function2,
        function3
    ).then(function(responses) {
        console.log(responses);
    });
    

提交回复
热议问题