I'am using routing with children which should be loaded in separate outlet. All the components are placed directly inside the /app folder.
app.router.ts:
export const router: Routes = [
{ path:'dashboard', canActivate:[AuthguardGuard], component: DashboardComponent },
{ path:'', component: LoginComponent },
{
path: 'dashboard', component: DashboardComponent,
children: [
{ path:'features', component: FeaturesComponent, outlet:
{ path:'signup', component: SignupComponent, outlet: 'content' },
{ path:'more', component: MoreComponent, outlet: 'content',
{ path: '**', component: PageNotFoundComponent }
]
}
];
dashboard.component.html:
<a [routerLink]="['./']">Overview</a>
<a [routerLink]="['features']">Features</a>
<a [routerLink]="['details']">How To</a>
<a [routerLink]="['more']">SignUp</a>
<a [routerLink]="['signup']">SignUp</a>
When loading the app under: http.//localhsot:4200
, I first start with a login component/page (loaded in unnamed router-outlet as default) which checks a user and pass. After that it goes to dashboard component/page (using AuthguardGuard). URL is then: http://localhost:4200/dashboard
From the dashboard page I want to be able to navigate to other pages/components, and they should be loaded in the outlet:"content"
app.component.ts:
<main class="mdl-layout__content">
<div class="mdl-layout__tab-panel is-active" id="overview">
<router-outlet></router-outlet>
<router-outlet name="content"></router-outlet>
</div>
</main>
I have been trying few suggestions found here on the platform, but none of them did help. e.g.:
<a [routerLink]="['signup', {outlets: {content: 'signup'}}]">SignUp</a>
<a [routerLink]="['../signup']">SignUp</a>
But it didn't work... different errors like:
Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'signup'
Any Idea what I'am doing wrong or what should I change or add please?
Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'signup'
– k.vincent