angular - How to specify auxiliary component for child route in angular2 router3 -
i using new route3 , know url syntax specify auxiliary component child route.
i have following child route definition:
const router: routerconfig = [ { path: 'component-c', component: componentc, children: [ { path: 'auxpath', component: componentaux, outlet: 'aux'}, { path: 'c1', component: componentc1 } ] } ];
and template componentc like
@component({ selector: 'component-c', template: ` <div>child route component</div> <router-outlet></router-outlet> <router-outlet name="aux"></router-outlet> `, directives: [router_directives] })
url /component-c/c1 displays componentc1; however, i've tried many combinations /component-c(aux:auxpath)/c1, /component-c/c1(aux:auxpath), etc. , still can't figure out how componentaux displayed...
you should try forming url below.
this.router.navigatebyurl('/component-c/(c1//aux:auxpath)
as per last investigation current router version has issues in navigating aux outlet using routerlink
, navigate
method. should build full url , use navigatebyurl
.
plunker example. click on detail button , admin. admin routed in admin outlet. open in full screen see url formation.
the url has following semantics
- child path separated /
- if path has siblings should surrounded parenthesis ()
- sibling separated //
outlet , path separated :
parent/child/(gchild1//outletname:gchild2)
another question
Comments
Post a Comment