How to trace routing in Angular 2?

You can pass in a second argument with options:

imports: [
    RouterModule.forRoot(
      routes,
      { enableTracing: true } // <-- debugging purposes only
    )
]

Angular will then log all events to the browser’s console, per the documentation:

enableTracing?: boolean
When true, log all internal navigation events to the console. Use for debugging.

Leave a Comment