router.navigate不适用于使用angular-8.x的子路由

时间:2019-06-08 03:20:06

标签: angular typescript routing angular-routing angular8

我的路由配置如下:

heroku create

我有一些可注射的服务,如下所示:

export const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full'},
  {
    path: "register",
    component: Abc,
    canActivate: [NotAuthGard]
  },
  {
    path: "xyz",
    component: Xyz,
    canActivate: [AuthGard],
    children: [
      { path: "xy1", component: XY1 },
      { path: "xy2", component: XY2 },
    ]
  },
  { path: "pqr", component: Pqr, canActivate: [AuthGard] },
  { path: '**', component: PageNotFoundComponent },
];

当我使用activity.goto('xyz / xy1')进行路由或通过浏览器('/ xyz / xy1')进行加载时,它适用于根路由,但对于子路由,它仅重定向至本地。 / p>

0 个答案:

没有答案