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.
1 | 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.
1 2 3 4 5 6 7 8 9 10 | 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.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.