I have routes declared like this:
const appRoutes: Routes = [
{
path: '',
component: AppComponent,
children: [
{
path: 'elenco-interventi',
component: InterventiComponent,
children: [
{
path:'nuovo-intervento',
component: NuovoInterventoComponent
}
]
},
]
}
]
In the AppComponent
I just have a <div>
with a <router-outlet>
inside, and the component InterventiComponent
is correctly loaded at address /elenco-interventi
. Then I want the children NuovoInterventoComponent
to be found at address /elenco-interventi/nuovo-intervento
, and it has to entirely replace the content of the parent component.
How do I have to use the <router-outlet>
in parent correctly so that I can replace the entire content of the parent page, and also reload parent page and hide/not show children component content if I go back with the routing?
Example:
<div>
<!--parent content-->
<router-outlet></router-outlet> ==> when routing to children, just show children content
and not children+parent content as I do now
</div>