Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexzuza/772d820ea0efaacfb2842f5e88db39fe to your computer and use it in GitHub Desktop.
Save alexzuza/772d820ea0efaacfb2842f5e88db39fe to your computer and use it in GitHub Desktop.
DI simple application with lazy loading
@Component({
selector: 'child',
template: `
Child
<router-outlet></router-outlet>
`
})
export class ChildComponent {}
...
@NgModule({
imports: [
BrowserModule,
RouterModule.forRoot([
{
path: 'child', component: ChildComponent,
children: [
{
path: 'grand-child',
loadChildren: './grand-child/grand-child.module#GrandChildModule'}
]
},
{ path: '', redirectTo: '/child', pathMatch: 'full' }
])
],
declarations: [
AppComponent,
ChildComponent
],
bootstrap: [AppComponent]
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment