Changed to work with Angular 1.2's new promise hierarchy.