无法匹配任何路由。有角度的

时间:2021-07-11 16:14:05

标签: angular typescript routes

core.js:6162 错误错误:未捕获(承诺):错误:无法匹配任何路由。 URL 段:'登录' 错误:无法匹配任何路由。网址段:'登录'

导致上述问题的原因是什么?我有一个来自电子邮件的确认链接,该链接类似于 http://localhost:4200/#/login/(auth/key:c1b6e91c-323e-4d72-9848-46814276e5ca) 当用户单击或打开它时,它将重定向到登录页面,但我收到了上述错误。有什么想法吗?

登录路由有效,但我想创建一个将使用登录组件的路由,但 URL 类似于

"http://localhost:4200/#/login/(auth/key:c1b6e91c-323e-4d72-9848-46814276e5ca)

#我的路线代码

const routes: Routes = [
  {
    path: '',
    component: DashboardComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'properties',
        loadChildren: () => import('./features/property/property.module').then(m => m.PropertyModule),
        canActivate: [AuthGuard],
        data: {
          userRoles: [Roles.ADMIN, Roles.TRANSACTION_SUPER_USER, Roles.TRANSACTION_MANAGER]
        },
      },
      {
        path: 'settings',
        loadChildren: () => import('./features/settings/settings.module').then(m => m.SettingsModule),
        data: {
          title: 'Settings',
          userRoles: [Roles.ADMIN, Roles.TRANSACTION_SUPER_USER, Roles.TRANSACTION_MANAGER]
        }
      },
  {
    path: 'login',
    component: LoginComponent,
  },
 {
  path: 'login/auth/key:urlapikey', component: LoginComponent,
  outlet: 'runtime', 
  data: {
    title: 'Runtime Login'
  }
}

0 个答案:

没有答案