【发布时间】:2016-07-28 17:43:25
【问题描述】:
美好的一天。我不明白 Angular 2 rc 4 中带孩子的新路线是如何工作的。
我想路由到有孩子的 TestComponent,但出现错误“cannot match any route 'test'”。我这样路由:this.guide.navigate(['test']);。
这就是我声明我的路线的方式:
const routes: RouterConfig = [
{
path: '',
component: LogInComponent
},
{
path: 'pin',
component: PinComponent, },
{
path: 'test',
component: TestComponent,
children: [
{
path: '/:page',
component: FoodComponent
}
]
}
]
export const mainRouterProviders = [
provideRouter(routes)
];
默认情况下,我不能在测试中使用某些页面(例如“路径:'/'”),因为它的子项就像选项卡,并且它们的列表加载到 TestComponent 的构造函数中。
【问题讨论】:
标签: typescript angular