Is it possible bind RouterConfig to different components with this updated angular-router?
For example, i have two components on my "app.components.ts":
@Component({
template: require('./app.component.html'),
directives: [ ROUTER_DIRECTIVES ]
})
Template in this component includes custom view decorations + router-outlet for child components.
export const insideRoutes: RouterConfig = [
{ path: 'dashboard', component: DashboardComponent }
];
And has his own router, that will load this component on specified route.
Also i have top level component:
@Component({
selector: 'app',
pipes: [],
providers: [ AppState ],
template: '<router-outlet></router-outlet>',
directives: [ ROUTER_DIRECTIVES ]
})
Template in this component will have just custom (login) page.
export const outsideRoutes: RouterConfig = [
{ path: 'login', component: LoginComponent }
)}
And i want to load this component, only using route on RouterConfig above.
I'm tried to include both RouterConfig's in "app.routes.ts" like this:
export const appRouterProviders = [
provideRouter([outsideRoutes, insideRoutes])
];
Linked "appRouterProviders" to application bootstrap in "main.browser.ts":
export function main(initialHmrState?: any): Promise<any> {
return bootstrap(AppComponent, [
...PROVIDERS,
...DIRECTIVES,
...PIPES,
...APP_PROVIDERS,
...ENV_PROVIDERS,
...HTTP_PROVIDERS,
appRouterProviders,
provide(LocationStrategy, { useClass: HashLocationStrategy })
]).catch(err => console.error(err));
}
But got router error.
If i'm using just one RouterConfig, like that:
export const appRouterProviders = [
provideRouter(outsideRoutes) // or insideRoutes
];
It works, but it's using only my root component (top level component, which has only router-outlet.
At least i got this work on "angular2: 2.0.0-beta.14" with old and usefull @RouteConfig.