Video Course

Routing Angular v2+ Applications: Lesson 13 of 23

About Module

Up Next

Child Routes

Autoplaying in 7 seconds!

Cancel

Create a Free Account to Watch

Sign Up Now

Login to your account

We're going to refactor our entire about section to be it's own Angular NgModule.

The reason we do this is because we can lazy-load that entire section and only load it when our users want access to it. This keeps our app lean for our users.

app/about/about.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AboutComponent } from './about.component';
import { AboutUserComponent } from './about-user.component';
import { UserService } from '../shared/services/user.service';
import { aboutRouting } from './about.routing';

@NgModule({
  imports: [
    CommonModule,
    aboutRouting
  ],
  declarations: [
    AboutComponent,
    AboutUserComponent
  ],
  providers: [
    UserService
  ]
})
export class AboutModule {}

Chris Sevilleja

157 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.