Router Events

Go back to Tutorial

During each navigation, the Router emits navigation events through the Router.events property. These events range from when the navigation starts and ends to many points in between. The full list of navigation events is displayed in the table below.

Router Event Description
NavigationStart An event triggered when navigation starts.
RouteConfigLoadStart An event triggered before the Router lazy loads a route configuration.
RouteConfigLoadEnd An event triggered after a route has been lazy loaded.
RoutesRecognized An event triggered when the Router parses the URL and the routes are recognized.
GuardsCheckStart An event triggered when the Router begins the Guards phase of routing.
ChildActivationStart An event triggered when the Router begins activating a route’s children.
ActivationStart An event triggered when the Router begins activating a route.
GuardsCheckEnd An event triggered when the Router finishes the Guards phase of routing successfully.
ResolveStart An event triggered when the Router begins the Resolve phase of routing.
ResolveEnd An event triggered when the Router finishes the Resolve phase of routing successfuly.
ChildActivationEnd An event triggered when the Router finishes activating a route’s children.
ActivationEnd An event triggered when the Router finishes activating a route.
NavigationEnd An event triggered when navigation ends successfully.
NavigationCancel An event triggered when navigation is canceled. This is due to a Route Guard returning false during navigation.
NavigationError An event triggered when navigation fails due to an unexpected error.
Scroll An event that represents a scrolling event.

These events are logged to the console when the enableTracing option is enabled also. Since the events are provided as an Observable, you can filter() for events of interest and subscribe() to them to make decisions based on the sequence of events in the navigation process.

 

Go back to Tutorial

Share this post
[social_warfare]
Activated Route
Angular 7 Promises, and Route Protection

Get industry recognized certification – Contact us

keyboard_arrow_up