The question may be elementary, but just in case we will ask for accuracy.

Suppose we have a promise (implementation of $q ):

 var foo1 = $q.defer().resolve(data).then(function(data) { // Do something }, function(err) { // Handling error } ); 

And somewhere in the code, we call it several times:

 foo1.then(function(data) { // Do something1 }); ... foo1.then(function(data) { // Do something2 }); 

Is this allowed? Or do you need a then().then().then() chain-structure or a wrapper in a new promise ?

  • @apiya, Please post your answer with an answer (or comment). Then we can mark it as correct. - Nicolas Chabanovsky

1 answer 1

Reply from comment:


I answer your question. Nevertheless, laziness took its toll and looked into the standard promise A + :

then may be called multiple times on the same promise.