A quick look at the source for $ q shows us that:
then: function(onFulfilled, onRejected, progressBack) { var result = new Deferred(); this.$$state.pending = this.$$state.pending || []; this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]); if (this.$$state.status > 0) scheduleProcessQueue(this.$$state); return result.promise; }
Thus, there is no special identifier that points to your anonymous callback in the $$state.pending stack to combine it.
I personally have not tried this before, but if you want to erase the pending stack, perhaps def.$$state.pending = []; will do the trick. Then you can simply reassign only the def.then() callbacks you want.
source share