Here's a simple little method for testing purposes that will log out each possible event name as they happen. There can be a lot that happen fast, so I recommend also going to your DevTools "Network" tab and enabling throttling to something like DSL speeds so you can see these events happen at an easier to understand speed.
this.router.events.subscribe((ev) => {
let navType = 'unknown!';
if (ev instanceof NavigationStart) {
navType = 'NavigationStart';
} else if (ev instanceof RouteConfigLoadStart) {
navType = 'RouteConfigLoadStart';
} else if (ev instanceof RouteConfigLoadEnd) {
navType = 'RouteConfigLoadEnd';
} else if (ev instanceof RoutesRecognized) {
navType = 'RoutesRecognized';
} else if (ev instanceof GuardsCheckStart) {
navType = 'GuardsCheckStart';
} else if (ev instanceof ChildActivationStart) {
navType = 'ChildActivationStart';
} else if (ev instanceof ActivationStart) {
navType = 'ActivationStart';
} else if (ev instanceof GuardsCheckEnd) {
navType = 'GuardsCheckEnd';
} else if (ev instanceof ResolveStart) {
navType = 'ResolveStart';
} else if (ev instanceof ResolveEnd) {
navType = 'ResolveEnd';
} else if (ev instanceof ChildActivationEnd) {
navType = 'ChildActivationEnd';
} else if (ev instanceof ActivationEnd) {
navType = 'ActivationEnd';
} else if (ev instanceof NavigationEnd) {
navType = 'NavigationEnd';
} else if (ev instanceof NavigationCancel) {
navType = 'NavigationCancel';
} else if (ev instanceof NavigationError) {
navType = 'NavigationError';
} else if (ev instanceof NavigationSkipped) {
navType = 'NavigationSkipped';
} else if (ev instanceof Scroll) {
navType = 'Scroll';
}
console.log(navType, ev);
});
In general though for most simple applications you only need to see when the navigation has ended, like this:
this.router.events.subscribe((ev) => {
let navType = 'unknown!';
if (ev instanceof NavigationEnd) {
//Do stuff here
}
});