我的项目中有两个布局。一个是Basiclayout,另一个是Locationlayout。当用户第一次访问网站时,他在Basiclayout中,但当他提供他的位置时,布局将是Locationlayout。如何根据这种情况在我的app-routing.module.ts文件中重定向?
我的app-routing.module.ts的代码段: -
const routes: Routes = [
{
path: '',
component: BasiclayoutComponent,
children: [
{ path: '', component: HomeComponent },
]
},
{
path: '',
component: LocationlayoutComponent,
children: [
{ path: '', component: HomeComponent },
]
}
];
答案 0 :(得分:0)
You could try something like this.
const routes: Routes = [
{
path: '',
component: BasiclayoutComponent,
children: [
{ path: 'home', component: HomeComponent },
]
},
{
path: 'location',
component: LocationlayoutComponent,
children: [
{ path: 'home', component: HomeComponent },
]
}
];
Basic Home: http://localhost:4200/home Location Home: http://localhost:4200/location/home