Getting all routes from current module - Angular 2

angular, angular2-routing, url-routing

Solution

You can use the router.config by injecting Router and pull the config.

constructor(private router: Router){
  console.log(this.router.config);
}

Problem

Hi m using lazy loading in my sample. ``` export const appRoutes: Routes = [ { path: 'comp1', loadChildren: 'app/components/comp1/comp1.module#comp1Module' }, { path: 'comp2', loadChildren: 'app/components/comp2/comp2.module#comp2Module' }, . . . ] ``` comp1Module having below sub routes Routes ``` export const comp1Routes: Routes = [ { path: 'comp1/default', component: DefaultComponent }, ]; ``` While routing i need to get all routed from the module. For ex: I want get all routes from the module comp1

Original source