I play with Angular 2 and I am having problems with the router. I want to have a second router output inside the main router.
Inside the first exit of the router, I am redirected to the home page, where I have a second router:
<router-outlet name="main"></router-outlet>
This app.routing application without import.
const appRoutes: Routes = [ { path: '', component: HomeComponent }, { path: 'login', component: LoginComponent}, { path: 'days', component: DaysComponent, outlet: 'main'} ]; export const appRoutingProviders: any[] = [ ]; export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
In HomeComponent ngOnInit, I have this
this.router.navigateByUrl('/(main:days)');
But this leads to a network failure with the following error:
Unprepared (in promise): Error: Unable to find the main outlet for downloading "DaysComponent"
How could a second router output inside the main one?
Thanks.
angular angular2-routing
troyz
source share