DEV Community

Yash Saxena
Yash Saxena

Posted on

Using NgModule vs Standalone components

I have been studying Angular from a free YouTube course by Procademy. We are working on different dev versions(node - 18.19.1 npm-10.8.1 ng-18.0.6). The creator created a sample project and there was an app.module.ts file by default but when I created the project it wasn't there. I started by creating components and using documentation I figured that If I create standalone components, I can just use imports to include it in another component. There are a few questions bugging me-

  1. Do I need to use or create the app.module.ts file sooner or later?
  2. I also tried to create the module.ts file by myself but it was not automatically registering the components by itself and it started throwing errors around imports and standalone. I removed the standalone property from the components and include them in the ts file but still throws error. Can someone experienced give me a holistic view and is there someplace I can learn with other people for free online.

Top comments (0)