I'm probably missing something fairly simple here, but I can't spot it.
From what I can see, my feature module is lazy loading successfully (in dev tools it only pulls in the files when the required link is selected). I've put break points in the code and can see it is hitting the template inside timesheet.component, but it is not rendering it, leaving me with a blank page (aside from the navbar component, which renders).
The files that get loaded are
1:
// timesheet.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { timesheetRoutes } from './timesheet.routes'
import { TimesheetComponent } from './timesheet.component'
@NgModule({
imports: [ CommonModule, RouterModule.forChild(timesheetRoutes) ],
declarations: [ TimesheetComponent ],
providers: [ ]
})
export class TimesheetModule
2:
// timesheet.routes.ts
import { Routes, RouterModule } from '@angular/router'
import { TimesheetComponent } from './timesheet.component'
export const timesheetRoutes: Routes = [
{ path: 'timesheet', component: TimesheetComponent }
]
3:
import { Component } from '@angular/core';
@Component({
template: `<h1>Mobile Timesheet</h1>`
})
export class TimesheetComponent {
}
My routes are as follows:
// routes.ts
import { CaseListComponent } from './cases/case-list.component';
import { CaseDetailComponent } from './cases/case-details/case-details.component';
import { Routes } from '@angular/router'
import { CaseListResolverService } from './cases/case-list-resolver.service';
export const appRoutes:Routes =
[
{ path: 'cases', component: CaseListComponent, resolve:
{cases:CaseListResolverService} },
{ path: 'cases/:irn', component: CaseDetailComponent },
{ path: '', redirectTo: '/cases', pathMatch: 'full' },
{ path: 'timesheet', loadChildren:
'app/timesheet/timesheet.module#TimesheetModule' }
]
App.component is bootstrapped, and calls the following:
<nav-bar></nav-bar>
<router-outlet></router-outlet>
nav-bar contains a routerLink as follows:
<a [routerLink]="['timesheet']">Time Sheet</a>