OnReuse

export interface OnReuse

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

Defines route lifecycle method routerOnReuse, which is called by the router at the end of a successful route navigation when CanReuse is implemented and returns or resolves to true.

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

The routerOnReuse 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.

Example

@Component({ selector: 'my-cmp', template: ` <div>hello {{name}}!</div> <div>message: <input id="message"></div> ` }) class MyCmp implements CanReuse, OnReuse { name: string; constructor(params: RouteParams) { this.name = params.get('name') || 'NOBODY'; } routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction) { return true; } routerOnReuse(next: ComponentInstruction, prev: ComponentInstruction) { this.name = next.params['name']; } }

Members

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

Not Yet Documented