The requirement I am trying to implement using Angular2 and the new component router is as follows: A page is divided into 2 sections. eg: (left,right) Each section will contain a component. Each component has its own routing and states. Is there any way to maintain the states using url? So that I will be able to share the link and get the components initialized into their states based on the url.
I have used auxiliary router outlet to represent each section. How can I represent both the auxiliary routes using the url? Or have I misunderstood the usage of auxiliary routes?
The example can be found at https://github.com/rmchndrng/ng2learnrouter
My routing configuration
export const routes: RouterConfig = [
{
path: '',redirectTo: '/home', terminal: true
},
{ path: 'home', component: HomeComponent },
{
path: 'heroes', component: HeroesComponent, outlet: 'left',
children: [
{ path: 'list', component: HeroesListComponent },
{ path: 'view/:id', component: HeroViewComponent },
]
},
{
path: 'villains', component: VillainsComponent, outlet: 'right',
children: [
{ path: 'list', component: VillainsListComponent },
{ path: 'view/:id', component: VillainViewComponent },
]
}
];
The example application is running at https://rmchndrng.github.io/ng2learnrouter/#/home
The following works
https://rmchndrng.github.io/ng2learnrouter/#/home(left:heroes/list) https://rmchndrng.github.io/ng2learnrouter/#/home(right:villains/list)
Where as I am looking for something like the following which will be able to represent both the router outlet states.
eg.
https://rmchndrng.github.io/ng2learnrouter/#/home(left:heroes/list,right:villains/list) https://rmchndrng.github.io/ng2learnrouter/#/home(left:heroes/list)(right:villains/list) etc.
My project dependencies.
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/forms": "0.1.1",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"es6-shim": "0.35.1",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.26",
"zone.js": "0.6.12"
}