InterviewHubPRO
Section Overview
Q225

Question 225 of 283

Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)

80%
Angular & Signals (283 Qs)•Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)

What are feature modules?

Feature modules are NgModules, which are used for the purpose of organizing code. The feature module can be created with Angular CLI using the below command in the root directory,

javascript
ng generate module MyCustomFeature //

Angular CLI creates a folder called my-custom-feature with a file inside called my-custom-feature.module.ts with the following contents

javascript
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

@NgModule({
imports: [
  CommonModule
],
declarations: []
})
export class MyCustomFeature { }

Note: The "Module" suffix shouldn't present in the name because the CLI appends it.