Angular 10 is the next version of Google’s popular web framework, Angular. In this blog post we look at some of the main new features that will ship with the version 10 release (scheduled for June 2020). The first point relates to an upcoming release of TypeScript. The next points relate to a new configuration syntax, changes to supported browsers and deprecations respectively.
Official support for TypeScript 3.9
- TypeScript 3.9 will be released in March 2019
- this version of TypeScript brings support for new features like type spread, which allows you to expand a type from a union type into a parent type
- this feature is useful for creating more flexible types
TypeScript 3.9 is a new release of TypeScript, which will be released in March 2019. This version of TypeScript brings support for new features like type spread, which allows you to expand a type from a union type into a parent type.
This feature is useful for creating more flexible types that can be used as the basis for other types and functions.
Dynamic Imports for Lazy-Loaded Modules
- new feature, dynamic imports for lazy-loaded modules
- example of how to use dynamic imports
The new Dynamic Imports feature allows you to import modules from a lazy-loaded module. For example, if you want to use a component called ‘MyComponent’ in your app, it would be possible using Dynamic Imports as shown below:
- You can use dynamic imports in any place where you normally import a file (e.g., @NgModule or @Component).
- In the current top-level scope where the dynamic import statement is located (i.e., root component), all of its dependencies will be loaded dynamically when they are needed at runtime.
New Default Browser Configuration
The new browser configuration will be the default for all new projects. This means that app developers no longer need to specify the browser they want their app to target, since Angular will now use the latest version of each browser and automatically set the appropriate configuration for you.
This means that Angular 10 is more efficient than previous versions because it doesn’t have to deal with multiple versions of browsers or detect what kind of device someone is using (like newer iPhones).
Deprecation of Support for IE9, IE10 and IE Mobile
Angular 10 deprecates support for Internet Explorer 9, 10 and Mobile. This means that you cannot use these browsers to run your application anymore. However, Microsoft has confirmed that IE11 will still be supported in future versions of the framework.
Google has made a similar announcement regarding its own frameworks: they will also no longer support the following versions:
- The most recent versions of Google Chrome (50+) or Safari (10+) on Mac OS X;
- The most recent version of Mozilla Firefox (50+) on Linux;
- All mobile browsers except Google Chrome for Android (current), Apple Safari 8+/9+/10+.
Deprecations and Breaking Changes in Angular 10
- angular 10 will be the last version to support IE9, IE10 and IE Mobile
- angular 10 will deprecate the routerLinkActive directive
- angular 10 will deprecate the support for dynamic imports
- angular 10 will deprecate the support for lazy-loading modules
Angular 10 will be the last version to support IE9, IE10 and IE Mobile. If you are using any of these browsers, then it is not recommended that you upgrade your application to this version as there may be some issues related with compatibility. For example:
- The routerLinkActive directive is being deprecated as it breaks all animations when used on a element with ngRoute in Angular 6 or above versions (including Angular 7). You should use *ngIf instead for conditional rendering of links (examples).
- Dynamic imports have been deprecated from Angular 2 onwards; hence no more need for them! It means that instead of importing something like
API Deprecations in Angular 10
- deprecation of the ‘ng Form’ form control
- deprecation of the ‘ngFormModel’ form control
- deprecation of the ‘ngFormControlName’ form control
- deprecation of the ‘ngFormControls’ form control
For example, if you want to use a component called ‘MyComponent’ in your app, it would be possible using Dynamic Imports as shown below:
- The ngForm module has been deprecated. Please use the new Angular CLI or ng update to update your codebase to use the new FormBuilder API instead.
- The ngFormModel and other form controls provided by this module have been marked as obsolete, so they will no longer be supported on older versions of Angular (below v10). You can still use them if you need them now, but please plan accordingly!
We’re excited to see what the future holds for Angular and TypeScript. We’re also looking forward to seeing how these new features will be adopted by developers in the community.