I'm trying to get my head around promises, using the Q module in node.js, however I have a small issue.
In this example:
ModelA.create(/* params */)
.then(function(modelA){
return ModelB.create(/* params */);
})
.then(function(modelB){
return ModelC.create(/* params */);
})
.then(function(modelC){
// need to do stuff with modelA, modelB and modelC
})
.fail(/*do failure stuff*/);
The .create method returns a promise then in each .then(), as expected one gets the resolved value of the promise.
However in the final .then() I need to have all 3 previously resolved promise values.
What would be the best way to do this?