带有子项的路径中的默认路径

Default path in a path with children

我正在使用 angular 6,对于应用程序的 cms,我在 app.modules.ts 文件中设置了以下路径。

{ path: 'cms', component: CmsComponentComponent, children: [
  { path: 'register', component: RegisterComponent },
  { path: 'login', component: LoginComponent },
  { path: 'profile', component: ProfileComponent, canActivate:[AuthGuard] },
  { path: 'educate', component: EducateComponent, canActivate:[AuthGuard] }
]},

我想要一个默认值 cms,所以如果我输入 app/cms,我就必须注册。

我该怎么做?

谢谢

据我了解,您只需添加如下重定向路由即可:

{ path: 'cms', component: CmsComponentComponent, children: [
  { path: 'register', component: RegisterComponent },
    ...
  { path: '', redirectTo: '/register', pathMatch: 'full' }
]},