From what I understand from Angular2 router documentation, the routes config default pathMatch strategy is "prefix", "prefix" pathMatch strategy means the the app router only needs to look on the start of the url and match it with the proper route.
Reference: https://angular.io/docs/js/latest/api/router/index/Routes-type-alias.html#!#matching-strategy
That been said, with the below configurations I would assume that this route should load ExampleComponent if I navigate to /abcdefg.
One problem that this is not working, am not sure what is wrong and i cant find much information about this on google or in @angular/router source code.
Thank you for your help.
const ROUTES: Routes = [
{ path: '', component: MainLayoutComponent, pathMatch: 'prefix', canActivate: [AuthGuard], children: [
{ path:'abc', pathMatch: 'prefix', component: ExampleComponent},
{ path: '', component: HomepageComponent }
]},
];
export const ROUTING = RouterModule.forRoot(ROUTES, { useHash: false });
Update #1, Trying Günter Zöchbauer suggestion.
new router configurations are:
now /abc/defg works but not /abcdefg
{ path:'abc', pathMatch: 'prefix',
children: [
{ path:'**', component:ExampleComponent},
]
}