I want HomeComponent to be a child component that opens inside a layout template (inside the router-outlet tag of LayoutComponent). I'm not getting any errors and the home page loads fine. It's just not inside the layout.
Here's a snippet of app.module.ts:
...
@NgModule({
declarations: [
AppComponent
],
imports: [
RouterModule.forRoot(appRoutes, { useHash: false, initialNavigation: 'enabled' }),
...
Here's the start of the main app routes. HomeComponent is in PagesModule:
export const appRoutes: Routes = [
{
path: '',
component: LayoutComponent,
children: [
{
path: '',
loadChildren: '../app/pages/pages.module#PagesModule',
}
]
},
...
pages.routing.ts:
export const PageRoutes: Routes = [
// { path: '', component: HomeComponent }, // tried this too
{
path: '',
component: LayoutComponent,
children: [
{ path: '', component: HomeComponent }
]
}
];
pages.modules.ts:
...
@NgModule({
imports: [
CommonModule,
JsonpModule,
AppCommonModule,
RouterModule.forChild(PageRoutes)
],
exports: [ ],
declarations: [ HomeComponent ]
})
export class PagesModule { }