最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How To resolve multiple promise in typescript - Stack Overflow

programmeradmin3浏览0评论

I have a service, which first loads a config file from server through an $http call then in it's success call back I am reading the file content, which actually contains a list of files to load from the server.

So I make another call to server to load all other files. Is there any way in TypeScript to return a promise which will get called only when all the promises are get resolved. Same like $q.all we had in angular 1.X

I have a service, which first loads a config file from server through an $http call then in it's success call back I am reading the file content, which actually contains a list of files to load from the server.

So I make another call to server to load all other files. Is there any way in TypeScript to return a promise which will get called only when all the promises are get resolved. Same like $q.all we had in angular 1.X

Share Improve this question edited Dec 21, 2018 at 8:03 PG1 1,2422 gold badges12 silver badges27 bronze badges asked Jan 18, 2017 at 5:09 Pavan TiwariPavan Tiwari 3,1874 gold badges35 silver badges74 bronze badges 2
  • 1 Possible duplicate of q.all for angular2 observables – eko Commented Jan 18, 2017 at 5:11
  • Possible duplicate of Angular 2 promise .all() with RxJS – seidme Commented Jan 18, 2017 at 5:23
Add a ment  | 

1 Answer 1

Reset to default 8
Promise.all([
    //task1,
    //task2,
    //task3,
  ]).then((value) => {doSomething()});

task can be any Promise call

发布评论

评论列表(0)

  1. 暂无评论