What Is New in Angular 8.0
| Category | Key Changes |
|---|---|
| New Features | Differential Loading, Ivy as an opt-in preview, Bazel build tool opt-in |
| Improvements | Router backward compatibility, web worker bundling, service worker registration |
| Breaking Changes | Node 10+ required, TypeScript 3.4+, Angular Material changes |
| Deprecations | Platform-specific @angular/http, Web Tracing Framework integration |
What is differential loading and how does it improve my app?
Differential loading is a new build process that creates separate bundles for modern and legacy browsers. The CLI now produces both ES2015+ and ES5 bundles, and the browser automatically loads the appropriate version based on its own capabilities.
This means modern browsers get smaller, faster-executing bundles without the extra transpilation and polyfills needed for older browsers. In practice, this can significantly reduce the bundle size for users on up-to-date browsers while maintaining compatibility for everyone else.
Is Ivy ready to use in Angular 8?
Ivy is available as an opt-in preview in Angular 8, not the default rendering engine. You can enable it by adding "enableIvy": true in the angularCompilerOptions within your tsconfig.json file.
This preview allows developers to start testing their applications with the new renderer and provide feedback. It's a critical step toward the stable release, but it's not yet recommended for production use due to potential breaking changes and ongoing development.
How does the router backward compatibility mode work?
The router now includes a backward compatibility mode to ease the upgrade path from older Angular applications. It helps handle legacy AngularJS URL formats and navigation patterns that were common in apps using angular-ui-router.
You can activate this mode by using the UrlHandlingStrategy to manage the transition between the old and new routing systems. This is a temporary bridge for migration projects and isn't needed for new applications.
What are the key breaking changes to be aware of?
Angular 8 requires Node.js version 10 or later and TypeScript 3.4 or later. The @angular/http library, deprecated since Angular 4.3, has been officially removed in favor of @angular/common/http.
Several Angular Material components have changed their APIs, including the CDK table, and the support for the Web Tracing Framework integration has been removed. Always check the update guide for a full list of changes affecting your specific codebase.
Can I use Bazel with the Angular CLI now?
Yes, Bazel is available as an opt-in build option in Angular 8. It promises significantly faster build times, especially for incremental builds and large-scale applications, by leveraging advanced caching and parallelization.
You can add it to your project using ng add @angular/bazel. However, it's still considered experimental for CLI-based projects and might involve a more complex configuration compared to the standard Webpack-based build.
FAQ
Should I enable Ivy in my production app on Angular 8?
No, it's not recommended for production yet. The Ivy preview in v8 is intended for testing and feedback. The API is still subject to change, and you might encounter compatibility issues with third-party libraries.
How do I know if differential loading is working for my users?
You can check by inspecting the network requests in your browser's developer tools. Modern browsers will load the es2015 bundles, while older ones will load the es5 bundles. The CLI handles this injection automatically.
I was using @angular/http. What should I do now?
You must migrate all your HTTP calls to use @angular/common/http. The HttpClient API is more powerful and has been the standard since Angular 4.3. The old http module is completely removed in v8.
Why did my build break after updating to Angular 8?
The most common causes are incompatible versions of Node.js (needs v10+) or TypeScript (needs 3.4+). Also, check for removed APIs like @angular/http or changes to Angular Material components that you might be using.
Is it worth switching to the Bazel builder for a small project?
Probably not. The initial setup complexity and the experimental nature of the CLI integration mean the standard Webpack-based build is still the best choice for most projects, especially smaller ones.