I'm using loadChlidren in application, but I have some confusion/strange behavior that I didn't understand why happend.
I have this app-routing-module.ts
const routes: Routes = [
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{
path: 'home',
component: InformationPageComponent,
data: {
title: 'INFO',
preTitle: 'VISUALIZZA_MODELLO'
},
},
{
path: '',
loadChildren: './visualizza-modello/modello.module#ModelloModule',
canActivateChild: []
},
{
path: '**',
component: PageNotFoundComponent//HomeComponent
}
];
And in modello-routing-module.ts I have :
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'visualizza-modello',
data: {
title: 'DELEGHE',
breadcrumb: 'VISUALIZZA_MODELLO',
preTitle: 'VISUALIZZA_MODELLO',
},
children: [
{
path: 'dettaglio-ditta',
data: {
title: 'RICERCA_PAT',
breadcrumb: 'RICERCA_PAT',
preTitle: 'VISUALIZZA_MODELLO'
},
children: [
{
path: 'dettaglio-quadro',
data: {
title: 'DETTAGLIO_MODELLO',
breadcrumb: 'VISUALIZZA_MODELLO',
preTitle: 'VISUALIZZA_MODELLO'
},
component: DettaglioQuadroComponent
},
{
path: '',
data: {
title: 'RICERCA_PAT',
breadcrumb: '',
preTitle: 'VISUALIZZA_MODELLO'
},
component: DettaglioDittaComponent,
}
]
},
{
path: '',
data: {
title: 'DELEGHE',
breadcrumb: '',
preTitle: 'VISUALIZZA_MODELLO'
},
component: DelegheComponent
},
]
},
])
],
exports: [RouterModule]
})
I want this behavior:
When I open project I want to routing in home page. When I click on Menu Visualizza Modello, I want to go on this page. When I click Home on breadcrumb I want to go back in home page.
This works but sometimes when I leave the page and come back only a blank page will appear, not home page.
Can you share with me any idea, how to fix this problem?