I am encountering an issue with Angular 8 routes. The problem lies in the child routes not functioning properly.
Here are my defined routes:
const routes: Routes = [
{
path: 'admin', component: MainComponent, children: [
{ path: 'uno', component: HomeComponent, outlet: 'sub' },
{ path: '', component: HomeComponent, outlet: 'sub' },
//{ path: '', component: HomeComponent, outlet: 'sub' },
]
}
];
When I access the URL localhost:5001/admin, both the "MainComponent" and "HomeComponent" are displayed on the browser. However, when attempting to access localhost:5001/admin/uno, I receive an error message in the console stating "Error: Cannot match any routes. URL Segment: 'admin/uno'".
Thank you for your assistance
** update **
In my app.component.html file, I have included:
<router-outlet></router-outlet>
And in the main.component.html file, I have the following code:
<div id="content" class="content">
<div>
<button routerLink="uno">Tab1</button>
</div>
<router-outlet name="sub"></router-outlet>
</div>