I have created an multiple angular projects in a single application.I have used routes in the root project and tried to communicate with the child projects but what happens is the url gets changed but the page is not rendering.
Root Page Routing:
export const routes: Routes = [
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full',
},
{
path: '',
component: DefaultLayoutComponent,
data: {
title: 'Home'
},
children: [
{
path: 'dashboard',
loadChildren: './views/dashboard/dashboard.module#DashboardModule'
},
{
path: 'flights',
loadChildren: '../../projects/flights/src/app/flight.module#FlightsSharedModule'
},
{
path: 'passengers',
loadChildren: '../../projects/passengers/src/app/app.module#PassengersSharedModule'
}
]
},
{ path: '**', component: DefaultLayoutComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(routes),
FlightsSharedModule.forRoot(),
PassengersSharedModule.forRoot()
],
exports: [ RouterModule ]
})
Flights Application Routes:
const routes: Routes = [{
path: '',
data: {
title: 'Flights',
},
children: [
{
path: '',
component: ListComponent,
data: {
title: 'List',
},
},
],
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
Passenger Application Routes
const routes: Routes = [{
path: '',
data: {
title: 'Passengers',
},
children: [
{
path: '',
component: ListComponent,
data: {
title: 'List',
},
},
],
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
In the root application routing if i remove the modules from the root the page shows an cascading effect like below
But if the import those projects as module the page is not rendering the particular components as well as instead of showing the default home page it shows the first application like below