0
我工作的Angular2应用程序,我注意到孩子的路线不从父路线延伸。这是设计吗?Angular2嵌套路由不正确的URL
例如,如果我有配置像这样的路由父路由器:
// In top-level component
router.config([
new AsyncRoute({
path: '/designer/:id',
name: 'Designer',
loader:() =>
System.import('app/components/design.component')
.then(c => c['DesignComponent'])
}),
new AsyncRoute({
path: '/planner/:id',
name: 'Planner',
loader:() =>
System.import('app/components/plan.component')
.then(c => c['PlanComponent'])
})
]);
和子路由器和路由在这些组件的定义如下所示:
// In child component, design.component for example
router.config([
new AsyncRoute({
path: '/model',
name: 'Model',
loader:() =>
System.import('app/design/components/model.component')
.then(c => c['ModelComponent'])
})
]);
当顶-level加载页面时我们可能会降落在http://localhost:5000/designer/10
例如,但导航到孩子路由时,URL最终被http://localhost:5000/model
而不是http://localhost:5000/designer/10/model
。
预计:
http://localhost:5000/designer/10/model
实际:
http://localhost:5000/model
我尝试这样做,它不工作。实际上它根本不导航。父路由器是否在不使用'[routeLink]'的情况下安装?另外,RC.0中有哪些变化?我将如何使用'router.navigate'最终导航到具有'/ ...'的路线? –
你可以创建一个允许重现的Plunker吗? –
贝塔17目前 –