Created
January 28, 2021 10:43
-
-
Save armanozak/ed1a83b897a263a477ffad9178faadab to your computer and use it in GitHub Desktop.
[How to Configure Angular Modules Loaded by the Router] Loading a module via router #blog #angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, NgModule } from "@angular/core"; | |
import { BrowserModule } from "@angular/platform-browser"; | |
import { RouterModule } from "@angular/router"; | |
import { FooModule } from "./foo.module"; | |
@Component({ | |
selector: "app-root", | |
template: "<router-outlet></router-outlet>" | |
}) | |
export class AppComponent {} | |
@NgModule({ | |
imports: [ | |
BrowserModule, | |
RouterModule.forRoot([ | |
{ | |
path: "", | |
loadChildren: () => 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