For completeness, here is the whole solution, using angular instead of underscore, with a chainable ‘when’. Nothing new in this code, just combined a bunch of the answers above.
var originalWhen = $routeProvider.when;
$routeProvider.when = function(path, route) {
route.resolve || (route.resolve = {});
angular.extend(route.resolve, {
CurrentUser : function(User) {
return User.current();
}
});
return originalWhen.call($routeProvider, path, route);
};