4. Create event feature module
In this section we will make a feature module and discuss lazy loading feature state. It will also be the beginning of our demo app that we will grow over the course.
1. Create a new EventModule feature module
ng g module event2. Add event container component
ng g c event/containers/event3. Add event feature module routes
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { EventComponent } from './containers/event/event.component';
@NgModule({
imports: [
CommonModule,
RouterModule.forChild([
{ path: '', component: EventComponent }
])
],
declarations: [EventComponent]
})
export class EventModule { }4. Add a lazy route to the AppModule
5. Add event and home navigation links to the AppComponent
6. Run the app and look at the feature module chunk in the console

StackBlitz link
Extras and Homework
Convert the HomeComponent into a feature module
Last updated