Using Anular CLI, how do you create a new feature module that will be automatically imported to your main app module?

Experience Level: Junior
Tags: AngularAngular CLI

Answer

A feature module can be created by running the following command from the command line:

ng generate module name-of-your-module --module app

By executing the above commnd you are telling Angular CLI to create a module name-of-your-module and to include it in the application module app.

  • The feature module will be created in its own folder src/app/name-of-your-module/feature-module.cs
  • The app module file src/app/app.module.ts will be modified as the feature module will be imported into it

Comments

No Comments Yet.
Be the first to tell us what you think.
Angular CLI for beginners
Angular CLI for beginners

Are you learning Angular CLI ? Try our test we designed to help you progress faster.

Test yourself