I have an issue with angular routing.
When I try to go to the my.domain/new-york I've got correct page (HomeComponent)
But when I try to go to the my.domain/new-york/search I've got HomeComponent to instead SearchComponent. What I did wrong?
const routes: Routes = [
{
path: '',
component: BasicComponent,
children: [
{
path: '',
component: HomeComponent,
data: {
headerDark: true
}
},
{
path: ':city',
component: HomeComponent,
data: {
headerDark: true
},
children: [
{
path: ':category',
component: HomeComponent
},
{
path: 'search',
component: SearchComponent,
data: {
headerDark: true
}
},
]
},
]
}
];
UPD: I use two modules:
const routes: Routes = [
{
path: '',
loadChildren: () => import('./modules/basic/basic.module').then(mod => mod.BasicModule),
runGuardsAndResolvers: 'always'
},
{
path: 'dashboard',
canActivate: [AuthService],
loadChildren: () => import('./modules/dashboard/dashboard.module').then(mod => mod.DashboardModule)
},
{
path: '**',
redirectTo: '/'
}
];
UPD 2: Example https://stackblitz.com/edit/angular-ghafx6?file=src%2Fapp%2Forders%2Forders-routing.module.ts