【发布时间】:2017-02-28 16:23:31
【问题描述】:
我有子路由,我需要将父节点从 http 请求中获取的日期传递给子路由。我尝试使用服务来共享数据,但我只想要一个请求。
这是我的路线:
const routes: Routes = [
{
path: 'page/:category',
component: PageComponent,
children: [
{
path: ''
},
{
path: '/:id',
component: PageDetailComponent
}
]
}
];
我的第二个问题是如何处理带有可选参数的路由(无需重新加载组件)
http://example.com/route
和
一样http://example.com/route/param
【问题讨论】:
-
@GünterZöchbauer 非常感谢,完美运行!