Whats New in Angular 8?
Ah, Angular 8!
The version where things get a bit fancier, a little faster, and developers collectively sighed in relief at some much-needed improvements.
π New Features in Angular 8
1. Differential Loading of JavaScript
Angular 8 introduced differential loading, which means your modern browsers get modern JS, while older browsers get the legacy stuff. This improves performance significantly.
1
2
| <script type="module" src="modern-bundle.js"></script>
<script nomodule src="legacy-bundle.js"></script>
|
2. Lazy Loading with Dynamic Imports
Previously, lazy loading used a string-based syntax. Now, it’s more TypeScript-y and supports dynamic imports!
1
2
3
| const routes: Routes = [
{ path: 'lazy', loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule) }
];
|
Need to offload heavy computations to a separate thread? Web Workers are officially supported now!
1
| ng generate web-worker my-worker
|
4. Bazel Support (Experimental)
Bazel allows faster incremental builds and better dependency management. Itβs still experimental but promising!
1
2
3
| "builders": {
"build": "@angular/bazel"
}
|
5. Ivy Rendering Engine (Still in Preview)
Ivy was getting polished in Angular 8 but wasnβt the default yet. It improves bundle size and debugging!
6. Support for TypeScript 3.4+
Angular 8 brings support for the latest TypeScript goodies, like const assertions:
1
| const numbers = [10, 20, 30] as const;
|
7. Location Strategies Improved
Base href handling got better for lazy-loaded modules!
1
| providers: [{ provide: APP_BASE_HREF, useValue: '/' }]
|
π Angular Versions and Features
Version | Release Date | Key Features |
---|
Angular 2 | 2016-09-14 | Component-based architecture, TypeScript adoption |
Angular 4 | 2017-03-23 | Smaller bundles, better animations, improved AOT |
Angular 5 | 2017-11-01 | Build optimizer, HttpClient, Service workers |
Angular 6 | 2018-05-04 | Angular Elements, Tree-shakable providers, CLI improvements |
Angular 7 | 2018-10-18 | CLI prompts, better performance, Virtual Scrolling |
Angular 8 | 2019-05-28 | Differential loading, Ivy preview, Web Workers |
π Reference Links
π Key Ideas Summary
Feature | Description |
---|
Differential Loading | Modern JS for modern browsers, legacy JS for old ones |
Lazy Loading | Uses dynamic imports, making it more modular |
Web Workers | Allows background processing for performance |
Bazel Support | Faster builds, better dependency management (experimental) |
Ivy Rendering Engine | New, lightweight rendering engine (preview in Angular 8) |
TypeScript 3.4+ | Supports new TypeScript features |
Location Strategy | Improved handling of base hrefs |