45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../router'>angular2/router</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.37/modules/angular2/src/router/interfaces.ts#L34-L61">angular2/src/router/interfaces.ts (line 34)</a>
|
|
|
|
:markdown
|
|
Defines route lifecycle method [onReuse], 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].
|
|
|
|
## Example
|
|
```
|
|
@Directive({
|
|
selector: 'my-cmp'
|
|
})
|
|
class MyCmp implements CanReuse, OnReuse {
|
|
canReuse() {
|
|
return true;
|
|
}
|
|
|
|
onReuse(next, prev) {
|
|
this.params = next.params;
|
|
}
|
|
}
|
|
```
|
|
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3#onReuse onReuse
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction)
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|