Angular, Software Development

Angular – Bootstrap Another Module other than AppModule

This post demonstrates how to change a newly created Angular project to use another @NgModule other than the default AppModule class.

Requirements

  • Angular CLI
  • NPM 6.4.1
  • Node v8.11.3
  • Internet connection

Setup

Install Node and NPM first before Angular CLI.

Create a new Project

Next, invoke this command on the command-line prompt to create a new Angular project:

New Module

For this purpose, we need to make a copy of the app folder and its contents. Then, modify the new files to the correct ones within the same folder.

Modify main.ts

Modify main.ts to use the new @NgModule class in app2/app2.module.ts

Stop and start if the project is currently served via ng serve.

Testing

We now load a new @NgModule.

Download the Files

https://github.com/Turreta/Angular-Bootstrap-Another-Module-other-than-AppModule

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like