Back to Tips

enableTracing and withDebugTracing()

For debugging purposes around router events, Angular provides an easy way to log all internal navigation events to the console

const routes: Routes = [];
@NgModule({
  import: [RouterModule.forRoot(routes, { enableTracing: true })],
  exports: [RouterModule],
})
export class AppRoutingModule {}

If you're not using an ngModule to bootsrtrap your app, Angular also provides a way to enable debug tracing

const appRoutes: Routes = [];
bootstrapApplication(AppComponent, {
  providers: [provideRouter(appRoutes, withDebugTracing())],
});

Support

If you enjoyed this tip and found it useful, consider buying me a coffee. Thanks in advance!

Buy Me a Coffee at ko-fi.com
Using Angular v.18.0.6 🚀