Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Porting Promise.all functionality from AngularJs to VueJs

I have this function that I need to move from AngularJs to VueJs and it has me stumped! Any help would be appreciated :)

items = {
    one: {...details here...},
    two: {},
}

AngularJs

var promises = [];
var deferred = $q.defer();

angular.forEach(items, function(details) {
    promises.push(details.promise);
});

$q.all(promises).finally(function() {
    deferred.resolve();
});

return deferred.promise;

What I have in VueJs so far

let promises = [];

for (let [name, details] of Object.entries(items)) {
    promises.push(new Promise((resolve) => {resolve(details)}));
}

return Promise.all(promises);

Thank you!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is no need for new Promise because Promise.all allows for non-promise values.

For a promise that resolves with undefined (this is what a deferred does) when all object values are settled (i.e. resolved or rejected), it's:

Promise.all(Objects.values(items).map(({ promise }) => promise))
.then(() => {}) // if it's necessary to resolve with undefined
.catch(() => {}) // if it's necessary to not reject

If all values aren't promises, there is no need for Promise.all at all.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!