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:
1 | ng new practice |
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