I have a component
which renders some set of child routes but the layout is different - Can we use same path name for both layouts as below
{
path: '',
component: LandingComponent,
children: [
{ path: '', component: LandingpageComponent },
{ path: 'landingpage', component: LandingpageComponent },
]
},
{
path: '',
component: DashboardComponent,
children: [
{ path: 'patients', component: PatientsComponent },
{ path: 'endrolPatient', component: ProfileComponent },
{ path: 'endrolPatient/:id', component: ProfileComponent },
]
}
In the above example the path names are same - when I run the application I can see the output - how does angular works with this kind off routing.
Yes, you can!
Basically, as per the Angular router structure, you can have multiple router path for the same component.
Say you want to use your component A with two links as following -
abc.com/first
abc.com/second
Here, in that case, you can use the same component.