Angular 2 个使用@Routes 的嵌套路由

Angular 2 Nested Routes using @Routes

我正在尝试做一些看似简单的事情。我有以下定义:

@Routes([
    { path: '/stores', component: StoresComponent },
    { path: '/stores/new', component: StoresCreateComponent}
])

当我导航到 /stores 时,我会显示现有商店的列表。我在那个页面上有一个 link 导航到一个屏幕来创建一个新的商店。但是,当我导航到 /stores/new 时,我得到以下信息:

browser_adapter.ts:78Error: Uncaught (in promise): Component 'StoresComponent' does not have route configuration

我是 Angular 的新手,所以我不完全确定我需要做什么才能让这样的路线正常工作。

对路线进行排序,使更具体的路线排在最前面,不太具体的路线排在最后。这是 RC.1 路由器的当前限制。

@Routes([
    { path: '/stores/new', component: StoresCreateComponent}
    { path: '/stores', component: StoresComponent },
])