Combining promises in Angular 2

前端 未结 2 1652
萌比男神i
萌比男神i 2020-12-21 03:35

Is there any way to combine promises in AngularJS 2? In Angular 1, for instance, I would use $q.all to combine multiple requests into a single promise. Is there

2条回答
  •  囚心锁ツ
    2020-12-21 04:17

    I recommend using Observables for Angular 2+ but in case you still need to use Promises you can use the following:

    Promise.all(
          [
             promise1,
             promise2, 
             promise3
          ]
    );
    

提交回复
热议问题