Angular › NgModules & Modular Architecture
Why has Angular moved toward standalone components as the recommended default over NgModules?
AdvancedAnswer
Standalone components remove a significant amount of boilerplate, since each component explicitly declares its own dependencies directly rather than needing to be registered inside a separate NgModule. This simplifies the mental model for new developers, reduces the files needed for a typical feature, and makes tree shaking unused code easier for Angular's build tools.
// Standalone component, no separate NgModule needed at all
@Component({
selector: 'app-order-list',
standalone: true,
imports: [CommonModule, RouterLink],
template: `<a [routerLink]="['/orders', order.id]">{{ order.name }}</a>`
})
export class OrderListComponent {
@Input() order!: Order;
}Real-world example A team building a brand new Angular app skips creating any NgModules entirely, using only standalone components throughout, resulting in noticeably fewer files and less boilerplate compared to how the same app would have been structured a few years earlier.