I have some routes in an Angular 13 app which load other modules that contain a number of child routes.
My routing is set up in each module:
@NgModule({
declarations: [DashboardComponent],
imports: [RouterModule.forChild(childRoutes)]})
export class ChildModule{}
export const childRoutes = [
{path: 'dashboard', component: DashboardComponent},
{path: 'reports', component: ReportsComponent}];
My parent module lazy loads the child module:
export const appRoutes = [
{path: 'store', component: StoreLayoutComponent,
loadChildren: () => import('app/store/child.module').then(m => m.ChildModule)}];
@NgModule({
imports: [
...
RouterModule.forRoot(appRoutes)
],
...})
export class AppModule {}
Both the urls https://localhost:4200/store/dashboard and
https://localhost:4200/dashboard load the child DashboardComponent.
The second url shouldn't be valid. Why is it valid?