Lifecycle hooks
Route components (view-models) can implement several lifecycle hooks to respond to navigation events:
canActivate
Called before activating the route. It can be used for authorization or to check if data is available.
activate
Called when the route is activated. Use this to load data or perform setup.
canDeactivate
Called before navigating away from the route. Can be used to prevent navigation if there are unsaved changes.
deactivate
Called when navigating away from the route. Use this for cleanup.
Last updated
Was this helpful?