Angular routing redirectTo doesn’t work with Lazy Loading

I work on Angular project and for now I have only one lazy loaded module. When I try to reach localhost:4200/budget I want it to redirect to localhost:4200/budget/expenses. Budget is lazy loaded component. But when I try:

path: '',
component: BudgetComponentComponent,
redirectTo: 'expenses',
children: [
  {
    path: 'expenses',
    pathMatch: 'full',
    component: ExpensesComponent,
  },
  {
    path: 'income',
    pathMatch: 'full',
    component: IncomeComponent
  }
  // { path: '**', component:  Page404Component}
]

it gives me this: enter image description here

my main routing file: enter image description here



Read more here: https://stackoverflow.com/questions/64901975/angular-routing-redirectto-doesnt-work-with-lazy-loading

Content Attribution

This content was originally published by KoboldMines at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: