angular/angular.js — pull request #2452 by dbinit (2013-04-19 16:23:13+00:00)
Title: feat($q): Add optional canceler and promise.cancel method

Add an optional argument to $q.defer to provide a canceling function.
This exposes a promise.cancel method that can be used to call the
canceling function and reject the promise.

See existing implementations in [Dojo Toolkit](http://dojotoolkit.org/api/dojo/Deferred) and [Promised-IO](http://github.com/kriszyp/promised-io) library
for reference.

This will make it easier to implement things like #1159.