Here is my routes:
const appRoutes: Routes = [
{
path: 'menu',
component: MenuComponent,
children:[
{
path: 'config',
component: ConfigurationComponent
}]
},
];
And here is my menu component html:
<app-menu-header></app-menu-header>
<div routerLink="/config">Configuration</div>
And I'm getting this error:
ERROR Error: Uncaught (in promise): Error: NG04002: Cannot match any routes. URL Segment: 'config'
I'm working with Angular 14, the other routes works well.
CodePudding user response:
Add parents route in routerLink:
<app-menu-header></app-menu-header>
<div routerLink="menu/config">Configuration</div>
CodePudding user response:
If you are in .../menu try taking out the / in
<div routerLink="config">Configuration</div>
Or use the full path, "/menu/config"