Reputation: 1781
Hi I have the following routes structure:
export const routes: Routes = [
{
path: 'site', component: MainViewComponent, pathMatch: 'full',
children: [
{ path: '', redirectTo: 'extra-details', pathMatch: 'full'},
{ path: 'extra-details', component: ExtraDetailsViewComponent}
]},
{ path: 'login', component: LoginViewComponent, pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent }
];
both login and 404 (Page not found) are working great, the thing is that when I try to access /site it is being redirected to /site/extra-details but it displays the 404 view. When I commented the '**' path I got the following error:
Error: Cannot match any routes. URL Segment: 'site/extra-details'
What am I missing?
Thanks, Matan
Upvotes: 0
Views: 819
Reputation: 17894
pathMatch
is required only when you are redirecting, remove it where you have defined component.
Upvotes: 2