When working with AngularJS, the $q.defer()
promise object has the ability to receive multiple notify callbacks without overwriting previous ones.
var def = $q.defer();
def.promise.then(null, null, callback1);
def.promise.then(null, null, callback2);
If you need to remove (unregister) a specific callback, such as callback2
, how can this be achieved?
Check out this live example: