angular/angular.js — pull request #2424 by laurent22 (2013-04-17 06:30:59+00:00)
Title: Adding `always` method to `$q` service.

The current implementation of `$q` doesn't support the [always()](http://api.jquery.com/deferred.always/) method. This is a very useful method since it can avoid creating duplicate code when you do not care about the outcome of a promise. Here's an example code:

// Cover the app with an overlay to disable user input. We
// want to remove it whether the initialization was successful
// or not.
LoadingOverlay.start();
Auth.initialize().then(function() {
LoadingOverlay.stop();
}, function() {
LoadingOverlay.stop(); // duplicate code!!
});

With an `always` method it could be simplified to just this:

LoadingOverlay.start();
Auth.initialize().always(function() {
LoadingOverlay.stop();
});

The proposed implementation is to add an `always()` method to the `promise` object. This method simply re-uses the existing `then()` method, which means it won't bloat the `$q` implementation.

If there's any interest in this implementation, I'd be glad to add the tests for it.