我默认尝试导航到子路线,所以这是我的路线:
const routes: Routes = [ { path: '', --> /config redirectTo: 'branding', component: ConfigurationComponent, children: [ { path: 'branding', component: BrandingComponent }, { path: 'channel-branding', component: ChannelBrandingComponent }, { path: 'date-time', component: DateTimeSettingsComponent }, { path: 'graph', component: GraphSettingsComponent }, { path: 'grid', component: GridSettingsComponent }, { path: 'labels', component: LabelSettingsComponent } ] }, ];
父路线为
/config
,子路线为/config/branding
,以此类推,如果有人导航到/config/branding
,则默认情况下我想转到/config
。我尝试使用redirectTo
,但这似乎破坏了所有东西。如何获得这种行为?
我默认尝试导航到子路由,所以这是我的路由:const路由:Routes = [{path:``,-> / config redirectTo:'branding',component:ConfigurationComponent,...] >
像这样在您的子数组中添加重定向