mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Merge pull request #5984 from mdekrey/angular-ui-router
Add ui-router transition promise
This commit is contained in:
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user