The wait is over! The Angular 6 grand finale is finally here. Angular lovers, all set for celebration? Because Angular v6 is a blessing in disguise. The framework is feature-complete.
Angular has been a major hit among developers in the past year. The release of Angular 5 in November 2017 made their lives easier than ever with its out-of-the-box features that outdid all the previous versions.
Continuing with the same theme as that of Angular 5 – “smaller, faster, and easier to use”, Angular 6 aims to provide developers with an even easier life. The latest version has a sync of Angular CLI and Angular Material.
Angular 6 is loaded with many impressive features and promising bug fixes:
Ivy Renderer
Ivy is a new renderer that is backward-compatible and aims at further improving speed, increasing flexibility, and decreasing size. As the Angular team promises, migrating to Ivy renderer is easy as pie. The code size will reduce and compilation will become faster. Angular v6 will probably have an experimental flag.
Bazel Compiler
To further improve incremental build, Angular 6 has brought with it bazel compiler. With the new compiler, developers don’t need to rebuild an entire application for a source code change, which keeps happening all the time. Rather, they can simply rebuild the code which gets changed and that which will be impacted by this change.
Almost all Google-built software, including their 500+ Angular apps, are already using bazel compiler.
Closure Compiler
This bundling optimizer helps create JavaScript artifacts for almost all web applications developed at Google. Compared to Webpack and Rollup bundles, Closure Compiler is used to continuously generate smaller bundles. You can also easily eliminate the dead code.
Angular Elements
Using Angular Elements, you can write reusable Angular components and publish them as Web Components. These components can then be used in any HTML page. The custom elements can also be embedded into other frameworks such as Vue, React, and Ember.
Component Dev Kit (CDK)
Component dev kit is included in the Angular Material library. It offers over 30 UI components and enables you to build your own UI component library. With support for Responsive Web Design layouts, CDK makes the use of libraries such as Flex Layout or knowledge of CSS Grid pointless.
Service Worker
Service Worker is a little script introduced to manage caching for an app. The difference between the service worker in Angular 5 and that in Angular 6 is that the latter has some bug fixes and advanced features.
Schematics and ng update
Angular CLI uses Schematics technology to generate Angular artifacts. So if you want custom templates, use Schematics with Angular CLI. Begin with Angular CLI 1.7 and use the ng update to automatically update your project dependencies and make automated version fixes. Schematics allow you to build custom code transformations such as ng update.
The ng update examines your package.json and recommends updates to your application by using its Angular knowledge.
Router
As of now, there is no way to know whether navigation was started via URL or via location change. But in Angular 6, NavigationStart has navigationSource and restoredState, which helps identify if a navigation was started imperatively or via location change. You should handle the two use cases differently for various use cases, such as for scroll position restoration.
- Version 4 of JavaScript’s Webpack module bundler is using the technique of scope hosting to generate smaller modules.
- The upcoming version has a different method for tying modules and services, where services will probably be “tree-shakable” i.e. these can be opted out of an application when not used.
- Angular 6 supports RxJS 6 library for JavaScript, which ensures reduced bundle sizes for standard use cases.