OnActivate

export interface OnActivate

exported from angular2/router defined in angular2/src/router/interfaces.ts (line 7)

Defines route lifecycle method routerOnActivate, which is called by the router at the end of a successful route navigation.

For a single component's navigation, only one of either OnActivate or OnReuse will be called depending on the result of CanReuse.

The routerOnActivate hook is called with two ComponentInstructions as parameters, the first representing the current route being navigated to, and the second parameter representing the previous route or null.

If routerOnActivate returns a promise, the route change will wait until the promise settles to instantiate and activate child components.

Example

@Component({selector: 'my-cmp', template: `<div>routerOnActivate: {{log}}</div>`}) class MyCmp implements OnActivate { log: string = ''; routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) { this.log = `Finished navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`; } }

Members

routerOnActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction) : any

Not Yet Documented