angular - Does angular2 support nested states/routes? -


does angular2 support nested states/routes? example in view port there 2 links , on clicking specific link present view further have more 1 link specific earlier link.

yes.

i made demo: http://plnkr.co/edit/icnezz0wtiay5bpqrq2y?p=preview

import {component, view, input} 'angular2/core'; import {     routeconfig, router, routeparams, router_directives } 'angular2/router'; import {persistentrouteroutlet} './persistent-router-outlet';   @component({}) @view({   template: 'product info here' }) class productinfo { }  @component({}) @view({   template: 'buy here' }) class productbuy { }   @component({}) @view({   directives: [...router_directives, persistentrouteroutlet],   template: `     <div>       <h2>product {{pid}}</h2>       <a [routerlink]="['info']">show info</a>       <a [routerlink]="['buy']">go buy</a>       <div>         <router-outlet></router-outlet>       </div>     </div>   ` }) @routeconfig([   {path: '/info', name: 'info', component: productinfo, useasdefault: true}   {path: '/buy', name: 'buy', component: productbuy} ]) class product {   pid   constructor(params: routeparams) {     this.pid = params.get('pid')   } }  @component({}) @view({   directives: [...router_directives],   template: `     info store   ` }) class storeinfo { }   @component({   selector: 'my-app',   providers: [],   directives: [...router_directives, persistentrouteroutlet] ,   template: `     <div>       <a [routerlink]="['./storeinfo']">see store info</a>       <a [routerlink]="['./product', {pid:1}]">see product 1</a>       <a [routerlink]="['./product', {pid:2}]">see product 2</a>       <div>         <persistent-router-outlet></persistent-router-outlet>       </div>     </div>   ` }) @routeconfig([   {path: '/', name: 'storeinfo', component: storeinfo, useasdefault: true}   {path: '/product/:pid/...', name: 'product', component: product} ]) export class app { } 

here's doc: https://angular.io/docs/ts/latest/guide/router.html#!#child-router

note there's problem persistent tabs: angular2 routing: persisting route tabs , child routes https://github.com/angular/angular/issues/6634


Comments