Angular 12 is the first super release of Angular since Angular 7 was released in December 2018. It contains many new features and improvements.
The following are some of the most notable changes:
- `@Component` decorator – In addition to being able to define classes that contain components, you can now use @Component to define classes that don’t necessarily have any components within them (such as a class that inherits from another class). This allows you to use both descriptors while keeping your code simple and organized.
Improved TypeScript version compatibility
Since Angular uses TypeScript, you’ll find that there are some changes to the language in this version. The most notable is that the language has been updated to version 3.4 of its superset—a major update that makes it compatible with even more modern features like async/await and arrow functions.
Angular 12 also includes support for decorators, which allow you to add behavior to functions without altering their signature or calling convention (i.e., how they’re invoked). This feature was previously only available through a separate library called @angular/router , but now all of your applications can benefit from it!Write MoreRegenerate Content
Better performance for large template binding expressions
- Improved performance for large template binding expressions
- Improved performance for large template binding expressions by using the new ngTemplateOutlet directive
Support for CSS Custom Properties in Styling Module
- Custom properties are a new feature of CSS that allows you to define custom properties for a component or element. They can be used to define variables such as colors, sizes, etc.
- Define a variable with a value (like $red) and then later change its value by assigning another number (like red = 2).
- Change the value of one variable without changing any other part of your code (e.g., if we want our red color at 100%, but only change its opacity from 0% back up towards 1%).
Deprecations, removals and breaking changes
- Deprecation of ngStyle
The deprecated ngStyle directive has been removed from the web components package. The useStrictNullChecks compiler option was also removed, as it’s no longer needed in Angular 12.
- Removal of animationBuilder service
AnimationBuilder is a service that allows you to build animations using their API, but there are other ways to do this now (see below). The AnimationBuilder class is moving into its own package. This means that you should remove any references to it from your codebase because they won’t exist anymore after December 31st 2019!
- Removal of ComponentResolver interface and associated behaviors
We’d like to thank all of the contributors who made this release possible, as well as our community for their hard work and support. We’re pleased with how far we have come in just over a year since the initial release of Angular 2; this is just one more step on our journey towards making web applications more accessible and intuitive.