如何在Angular 2.0中为Dart定义子路径

时间:2016-10-26 22:53:58

标签: angular dart angular-dart

在打字稿中,可以像这样定义子路径:

export const routes: Routes = [
  { path: '', redirectTo: 'product-list', pathMatch: 'full' },
  { path: 'product-list', component: ProductList },
  { path: 'product-details/:id', component: ProductDetails,
    children: [
      { path: '', component: Overview },
      { path: 'specs', component: Specs }
    ]
  }
];

在dart中@RouteConfig meta类似,但路径上没有 childen 属性来定义子路径。

在Dart中定义子路线的正确方法是什么?发布了针对dart的Angular 2.0,但在使用dart中的路由时,文档仍然完全缺乏。

1 个答案:

答案 0 :(得分:5)

是的,文档缺乏,我道歉。我们有一个新的子团队致力于解决这个问题,肯定会变得更好。目前,我可以提供一些帮助 - 您的ProductDetails组件只需要声明它自己@RouteConfig

@Component(...)
@RouteConfig(const [
  const Route(path: '', component: Overview),
  ....
])
class ProductDetails {}