【发布时间】:2016-05-25 14:49:59
【问题描述】:
在Angular2 Router 的文档中,配置部分说
在我们配置它之前,路由器没有路由定义。同时创建路由器并添加其路由的首选方法是将 @RouteConfig 装饰器应用于路由器的主机组件。
但在下面的示例中,它使用@Routes 装饰器而不是@RouteConfig,在许多示例中我看到使用@RouteConfig,这让我感到困惑,因为我不确定它是如何工作的......
@Routes([
{path: '/crisis-center', component: CrisisListComponent},
{path: '/heroes', component: HeroListComponent},
{path: '/hero/:id', component: HeroDetailComponent}
])
注意:我正在尝试使用 angular2 的候选发布版本
更新
我设法编写了一个示例,并使用新的装饰器@Routes 使其工作。
【问题讨论】:
标签: angular configuration routes router