OnDeactivate

export interface OnDeactivate

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

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 ComponentInstructions as parameters, the first representing the current route being navigated to, and the second parameter representing the previous route.

If routerOnDeactivate returns a promise, the route change will wait until the promise settles.

Example

@Component({selector: 'my-cmp', template: `<div>hello</div>`}) class MyCmp implements OnDeactivate { constructor(private logService: LogService) {} routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) { this.logService.addLog( `Navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`); } }

Members

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

Not Yet Documented