Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created January 28, 2021 10:45
Show Gist options
  • Save armanozak/a516526e2d66d57af906def20637805a to your computer and use it in GitHub Desktop.
Save armanozak/a516526e2d66d57af906def20637805a to your computer and use it in GitHub Desktop.
[How to Configure Angular Modules Loaded by the Router] Lazy-loading a module via router #blog #angular
// remove FooModule from imports
@NgModule({
imports: [
BrowserModule,
RouterModule.forRoot([
{
path: "",
loadChildren: () => import('./foo.module').then(m => m.FooModule),
}
])
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment