angular-cn/public/docs/js/latest/api/router/OnDeactivate-interface.jade

44 lines
972 B
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#L61-L87">angular2/src/router/interfaces.ts (line 61)</a>
:markdown
Defines route lifecycle method [onDeactivate], which is called by the router before destroying
a component as part of a route change.
If `onDeactivate` returns a promise, the route change will wait until the promise settles.
## 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#onDeactivate onDeactivate
pre.prettyprint
code.
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction)
:markdown