Skip to content

Generate a Module

Abhay Chawla edited this page Aug 19, 2018 · 3 revisions

Follow the following steps to generate a new module with routing: (for a new section of the application)

  1. Open the terminal and run the command: ng generate module module-name --routing

  2. Navigate to the project's app.module.ts:

  • import the module import { ModuleName } from './module-path.module'

  • declare the module in imports array making sure to mention it above the AppRoutingModule @NgModule({ imports: [ ModuleName ]})

  1. Import the SharedModule and declare it in the imports array of the newly created module to ensure that AngularMaterial components, Angular Font Awesome Icons and FlexLayout directives can be used within the components:
import { SharedModule } from '../shared/shared.module';
@NgModule({  imports: [ SharedModule ]})