angulartypescriptangular-routingangular14angular15

Angular 15 - Routing Module Issue


I updated to Anglar 15 and I'm having a problem with the redirect, according to what the error says, I have a double //, but the reality is that I don't have anything like that in my code.

**

PagesRoutingModule:**

const routes: Routes = [
  {
    path: "",
    redirectTo: "dashboard",
    pathMatch: "full",
  },
  {
    path: '/',
    loadChildren: () => import('./pages.module').then(module => module.PagesModule)
  },

**

AppRoutingModule**

const routes: Routes = [
  {
    path: '',
    redirectTo: "pages",
    pathMatch: 'full'
  },
  {
    path: 'login',
    loadChildren: () => import('./login-page/login-page.module').then(module => module.LoginPageModule)
  },
  {
    path: 'pages',
    canLoad: [AuthGuard],
    loadChildren: () => import('./pages/pages.module').then(module => module.PagesModule),
  },

I also tried removing the '/' from path inside my PagesRoutingModule, but this loops my application.


Solution

  • https://prnt.sc/1X6tk3NVC505

    you are again loading pagemodule in page routing module.