我有一个名为http://example.com/consultation的页面,它代表我站点中角度的登陆页面(第一页),路由如下所示 . 问题是:当链接是http://example.com/consultation时( consultation
之后没有任何内容我需要随机分配路由到 ask-question
和 service-page
. 任何想法如何实现这一点?
export const routes: Routes = [
{
path: 'consultation',
component: OnlineConsulationComponent,
children: [
{ path: '', redirectTo: 'ask-question', pathMatch: 'full' },
{ path: 'ask-question', component: AskQuestion },
{ path: 'service-page', component: ServicePage },
{ path: '**', redirectTo: 'ask-question' }
]
}
];
1 回答
你的重定向应该在前面有一个斜线
redirectTo:'/ ask-question'