2015-07-27 22:12:30 -07:00
p.location-badge.
exported from <a href='../router'>angular2/router</a>
2015-08-11 17:09:57 -07:00
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.34/modules/angular2/src/router/interfaces.ts#L7-L34">angular2/src/router/interfaces.ts (line 7)</a>
2015-07-27 22:12:30 -07:00
:markdown
2015-08-11 17:09:57 -07:00
Defines route lifecycle method [onActivate], 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].
If `onActivate` returns a promise, the route change will wait until the promise settles to
instantiate and activate child components.
## Example
```
@Directive({
selector: 'my-cmp'
})
class MyCmp implements OnActivate {
onActivate(next, prev) {
this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
}
}
```
2015-07-27 22:12:30 -07:00
.l-main-section
h2 Members
.l-sub-section
h3 onActivate
pre.prettyprint
code.
2015-08-11 17:09:57 -07:00
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction)
2015-07-27 22:12:30 -07:00
:markdown