onActivate abstract method
Called after component is inserted by a router outlet.
This will occur after initial change detection.
NOTE: If the component also extends CanReuse and is reused, this will be called again on the same instance.
class MyComponent extends CanReuse implements OnActivate {
User user;
@override
void onActivate(_, RouterState current) {
var userId = current.getParameter('userId');
getUserById(userId).then((user) => this.user = user);
}
}
Implementation
void onActivate(RouterState? previous, RouterState current);