Angular2的路由器上的组件的默认参数已弃用

时间:2016-11-03 16:53:41

标签: angular angular2-routing

我正在使用Angular2构建自定义CMS,我有两种类型的帖子(我们称之为typeAtypeB)除了此类型属性外,它们是相同的。

我想将PostListComponentPostEditorComponent重复用于这两种类型,但具有不同网址的类型。

我正考虑添加到RouteDefinition[](我仍然使用2.0.0-rc.2 @angular/router-deprecated):

{
    path      : '/admin/type-a',
    name      : 'Type A Post List',
    component : PostListComponent,
    arguments : { 'type' : 'typeA' }
}, {
    path      : '/admin/type-b',
    name      : 'Type B Post List',
    component : PostListComponent,
    arguments : { 'type' : 'typeB' }
}

但我找不到任何关于如何将此默认参数传递给Component的文档。我刚刚发现this related answer,但这不是同一个问题,我不想使用这样的解决方法。

任何提示都会非常感激!

0 个答案:

没有答案
相关问题