【发布时间】:2020-12-08 01:16:37
【问题描述】:
我想在具有所有相同组件的同一页面中使用角度路由,无论是 /frontpage 还是 /frontpage/param1/param2/param3。但只是用 param1 param2 param3 参数更新我的子组件..
我有一个首页组件,它有一堆子(及其子)组件。
我正在以一种没有 URL 更改的方式构建,它只是 /frontpage,但我想将我的查询和参数添加到我的 url 中以更新我的孩子。
但我并不真正了解如何做到这一点。
app.routing.ts
{
path: '',
redirectTo: 'frontpage',
pathMatch: 'full',
},
{
path: '404',
component: P404Component,
data: {
title: 'Page 404'
}
},
{
path: '', // honestly I just realized this was here lol. I can probably take this out right? lol.. It was part of the base I am using.
component: DefaultLayoutComponent,
data: {
title: 'Home'
},
children: [
{
path: 'frontpage',
loadChildren: () => import(etcetc).then(m => m.FrontpageModule)
},
frontpage-routing.module.ts
{
path: '',
component: FrontpageComponent,
data: {
title: 'Frontpage'
},
},
在哪里添加 /:param1/:param2/:param3 ??
谢谢!
【问题讨论】:
标签: angular