Angular 19, a planned update to the popular TypeScript-based web framework, is set to make standalone: true
the default for components, directives, and pipes. This change, announced in an Angular blog post on September 3, eclipses the use of NgModules. With the new default, developers no longer need to type the standalone: true
flag.
The announcement notes that a developer preview of the standalone feature was introduced with Angular 14 in June 2022. This made it possible to build applications that did not rely on NgModules, mechanism for organizing code in a modular structure. Standalone has since been stabilized and is now the recommended way to write Angular code. The Angular CLI generates components with standalone: true
by default. Angular documentation also now teaches “standalone first” to new Angular developers.
Standalone makes Angular easier to learn and start using, and adoption has been strong across the Angular ecosystem, the post said. It also enables new features. The directive composition API, for example, supports a better composition model for component behavior by allowing standalone directives to be applied in the declaration of a host component or directive. The deferrable views feature lazy-loads standalone components and directives at the template level to optimize Angular applications.
Angular’s builders do not intend to deprecate the standalone
option or NgModules. said the post. Developers can still write NgComponents by specifying standalone: false
in the component decorator. For existing standalone or NgModules code, plans call for applying an automated migration. A future Angular 19 update will remove standalone: true
for existing standalone components and add standalone: false
to existing NgModules to ensure they still work.
The current version of Angular 18 arrived May 22. Based on the schedule for previous releases, Angular 19 may be available sometime in November.