I am trying to implement routing in Angular 6 but there are issues with multiple levels of NgModules.
The structure of modules is the following (B and C are children of A):
A_Module
B_Module
C_Module
This is a segment of code from my top-level NgModule:
// A_Module
const routes = [
{ path: 'B', component: B_Component },
{ path: 'C', component: C_Component },
]
@NgModule({
declarations: [
A_Component
],
imports: [
B_Module,
C_Module,
RouterModule.forRoot(routes),
],
providers: [],
bootstrap: [A_Component]
})
export class A_Module { }
B_Component and C_Component are top-level components inside its own modules.
This solution doesn't work as there are no components from B_Module or C_Module declared inside this A_Module. The thing is that inside B_Module and C_Module there are many many components and moving everything to the A_Module is not the solution (that's why modules were made right - to clean and separate the code?).
Any solutions to that?