What is a standalone component, and why did Angular move away from NgModules?

Angular basics · Freshers

Model answer

A standalone component declares its own dependencies in its imports array (other components, directives, pipes) and does not need to belong to an NgModule. In current Angular, components are standalone by default.

NgModules were an extra layer: you had to declare a component in a module and keep module imports in sync. Standalone removes that step, makes code easier to learn and to lazy load, and reduces boilerplate. NgModules still exist in older code, and you may meet them in existing projects.

Tips

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions