This post demonstrates how to change a newly created Angular project to use another @NgModule other than the default AppModule class.
- Angular CLI
- NPM 6.4.1
- Node v8.11.3
- Internet connection
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:
ng new practice
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 to use the new @NgModule class in app2/app2.module.ts
Stop and start if the project is currently served via ng serve.
We now load a new @NgModule.
Download the Files