Angular 15 - 路由模块问题

问题描述 投票:0回答:1

我更新到 Anglar 15,我遇到了重定向问题,根据错误提示,我有一个双 //,但实际情况是我的代码中没有类似的内容。

**

页面路由模块:**

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

**

应用程序路由模块**

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),
  },

我还尝试从 PagesRoutingModule 内的路径中删除“/”,但这会循环我的应用程序。

angular typescript angular-routing angular14 angular15
1个回答
0
投票

您再次在页面路由模块中加载页面模块。

© www.soinside.com 2019 - 2024. All rights reserved.