Files
Angular-Docs-Cn/modules/@angular/router/src/interfaces.ts
T

27 lines
1.0 KiB
TypeScript
Raw Normal View History

2016-06-08 16:38:52 -07:00
import {RouteSegment, RouteTree, Tree} from './segments';
2015-07-07 15:44:29 -07:00
2016-05-03 11:35:07 -07:00
/**
* Defines route lifecycle method `routerOnActivate`, which is called by the router at the end of a
* successful route navigation.
*
* The `routerOnActivate` hook is called with the current and previous {@link RouteSegment}s of the
* component and with the corresponding route trees.
*/
2015-07-07 15:44:29 -07:00
export interface OnActivate {
2016-06-08 16:38:52 -07:00
routerOnActivate(
curr: RouteSegment, prev?: RouteSegment, currTree?: RouteTree, prevTree?: RouteTree): void;
2015-07-07 15:44:29 -07:00
}
2016-05-03 11:35:07 -07:00
/**
* Defines route lifecycle method `routerOnDeactivate`, which is called by the router before
* destroying a component as part of a route change.
*
* The `routerOnDeactivate` hook is called with two {@link RouteTree}s, representing the current
* and the future state of the application.
*
* `routerOnDeactivate` must return a promise. The route change will wait until the promise settles.
*/
2015-07-07 15:44:29 -07:00
export interface CanDeactivate {
2016-05-02 17:11:21 +00:00
routerCanDeactivate(currTree?: RouteTree, futureTree?: RouteTree): Promise<boolean>;
}