Using Node 4.x. When you have a Promise.all(promises).then()
what is the proper way to resolve the data and pass it to the next .then()
?
I want to do something like this:
Promise.all(promises).then(function(data){
// Do something with the data here
}).then(function(data){
// Do more stuff here
});
But I'm not sure how to get the data to the 2nd .then()
. I can't use resolve(...)
in the first .then()
. I figured out I can do this:
return Promise.all(promises).then(function(data){
// Do something with the data here
return data;
}).then(function(data){
// Do more stuff here
});
But that doesn't seem like the proper way to do it... What is the right approach to this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…