Is there a way to pass a return value of one promise down the chain not to the next one but to the following ones? Currently we typically nest promises to keep the value in the function scope, like this:
return getOrder()
.then(function (order) {
return getOrderlines(order)
.then(function (orderLines) {
//do something with order and orderlines
processOrderAndOrderlines(order, orderLines);
});
})
.then(function () { //do something else
});
Is it possible to somehow pass the order object down the promise chain to get something similar to:
return getOrder()
.then(function (order) {
return getOrderlines(order);
})
.then(function (orderLines) {
//do something with order and orderlines
processOrderAndOrderlines(order, orderLines);
});
.then(function () { //do something else
});