on3al on3al - 1 year ago 106
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.

Answer Source

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 {}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download