Angular 带有子级的路径中的默认路径
我使用angular 6,对于应用程序的cms,我在Angular 带有子级的路径中的默认路径,angular,angular6,angular-routing,Angular,Angular6,Angular Routing,我使用angular 6,对于应用程序的cms,我在app.modules.ts文件中设置了以下路径 { path: 'cms', component: CmsComponentComponent, children: [ { path: 'register', component: RegisterComponent }, { path: 'login', component: LoginComponent }, { path: 'profile', component: Prof
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' }
]},