Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda