最佳答案
使用 Node 4. x。当你有一个 Promise.all(promises).then()
什么是正确的方法来解决数据,并传递给下一个 .then()
?
我想这样做:
Promise.all(promises).then(function(data){
// Do something with the data here
}).then(function(data){
// Do more stuff here
});
但是我不知道如何把数据传送到第二个 .then()
。我不能在第一个 .then()
中使用 resolve(...)
。我发现我可以做到:
return Promise.all(promises).then(function(data){
// Do something with the data here
return data;
}).then(function(data){
// Do more stuff here
});
但这似乎不是正确的做法... ... 什么是正确的做法?