With lazy loading enabled in my Angular 7 app when I route to a child component I'm getting errors about MainComponent
not being in any module.
In app.module.ts
the MainComponent
is the one that loads when the app starts up. I'm seeing that component without issues. I then added this to my app.routing.ts
{ path: 'ftb', loadChildren: './floor-to-book/floor-to-book.module#FloorToBookModule'},
and in `floor-to-book-routing.module.ts I've got this:
const routes: Routes = [
{path: ':id', component: FloorToBookSweepComponent}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class FloorToBookRoutingModule {
}
If I go to .../ftb/1234
then I get this error:
Error: Component MainComponent is not part of any NgModule or the module has not been imported into your module. Error: Component MainComponent is not part of any NgModule or the module has not been imported into your module.
I've verified that MainComponent
only exists in the app-routing.module.ts
and app.module.ts