Merge pull request #5984 from mdekrey/angular-ui-router

Add ui-router transition promise
This commit is contained in:
Masahiro Wakame
2015-09-27 12:54:40 +09:00
2 changed files with 19 additions and 0 deletions
@@ -174,6 +174,20 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
this.$state.get();
this.$state.reload();
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
if (this.$state.transition) {
var transitionPromise: ng.IPromise<{}> = this.$state.transition;
transitionPromise.then(() => {
// transition success
}, () => {
// transition failure
}).catch(() => {
// transition failure
}).finally(() => {
// transition ended (success or failure)
});
}
// Accesses the currently resolved values for the current state
// http://stackoverflow.com/questions/28026620/is-there-a-way-to-access-resolved-state-dependencies-besides-injecting-them-into/28027023#28027023
var resolvedValues = this.$state.$current.locals.globals;
+5
View File
@@ -240,10 +240,15 @@ declare module angular.ui {
href(state: string, params?: {}, options?: IHrefOptions): string;
get(state: string): IState;
get(): IState[];
/** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */
current: IState;
/** A param object, e.g. {sectionId: section.id)}, that you'd like to test against the current active state. */
params: IStateParamsService;
reload(): void;
/** Currently pending transition. A promise that'll resolve or reject. */
transition: ng.IPromise<{}>;
$current: IResolvedState;
}