I have configure routes like below in home-routing.module.ts
export const HomeRoutingModule: Routes = [
{
path:'',
children:[
{
path:'',
component:FirstComponent,
data:
{
title: "first",
urls: [{ title: "first component", url: "first" }]
}
},
{
path:'',
component:SecondComponent,
data:
{
title: 'second',
urls: [{ title: "second component", url: "second" }]
}
}]
and my my home.module.ts is like bolow
imports: [
CommonModule,
HomeRoutingModule,
RouterModule.forChild(HomeRoutingModule)
],
declarations: [FirstComponent, SecondComponent, ThirdComponent]
and my app-AppRoutingModule.module.ts is like below
export const routes: Routes = [
{ path: "first", component: FirstComponent },
{
path: "",
children: [
{ path: "", redirectTo: "/first", pathMatch: "full" },
{ path: "first", loadChildren: "./home/home.module#HomeModule" },
]
}]
and my application.module.ts is like below
@NgModule({
declarations: [
AppComponent,
FirstComponent,
],
imports: [
BrowserModule,
AppRoutingModule
],
route first
is working but where as i try to open second
route url it is not working
but it showing error is like below
core.js:1673 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'second' Error: Cannot match any routes. URL Segment: 'second'