on3al on3al - 2 months ago 25
Dart Question

How are child routes definded in Angular 2.0 for Dart

In typescript a child route can be defined like so:

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 }

In dart the @RouteConfig meta is similar, but there is not a childen property on a Route to define child routes.

What is the proper way to define child routes in Dart? Angular 2.0 for dart was released, but the documentation is still completely lacking when it comes to using routes in dart.


Yes, documentation is lacking, I apologize. We have a new sub-team working on fixing this, definitely is going to get much better. For the time being, I can help a bit - your ProductDetails component simply needs to declare it's own @RouteConfig:

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