What’s new in Angular 5?
Another new update is coming in March of this year, but in the meantime, let’s take a look at some of the latest features of Angular 5.
1. Build optimizer
2. Improved compiler
Much of the magic of Angular is hidden in its compiler. Angular 2 and its ancestor AngularJS provided only JIT compilation. In further releases, AOT compilation has been added, although its performance was underwhelming. Angular 5 solves this issue by enabling faster AOT compilation. With the improved compilation process, it’s easier to indicate problem areas of application code during development, thus streamlining the overall process.
A new preserveWhitespaces option has been added in order to eliminate unnecessary spaces. This helps to reduce the final bundle. Three options are available:
- Set it for each component’s decorator.
- Turn it on in a tsconfig.json file and enable this option for the whole app.
- Select the default value from the framework.
4. TypeScript and Libraries Updates
The Angular 5 compiler now utilizes the transform feature of TypeScript 2.3. This improves performance by enabling faster builds and rebuilds.
TypeScript in templates is also available with this update. Now type check is carried out not only in the code components, but also in templates. Angular 5 also supports RxJS version 5.5.2, in which lettable operators are available as well as an updated zone.js / NgZone.
A new HttpClient had been added in version 4.3, but the old http client is marked as deprecated in the new version. In Angular 6, the old client will be removed. Among the advantages of the new client is the ability to use interceptors and the independent extraction of JSON without the need to apply the map method explicitly.
6. Simplified PWA development
Progressive web applications are gaining more and more popularity these days. PWAs built with Angular 5 combine the best of web and mobile applications. Now it can support service workers right out of the box, which helps...
- cache js html css to work without internet connection
- cache static content
- cache API requests
- enable push notifications
7. Pipes adopted for localization
Angular 5 includes updated pipes for Date, Currency, Number and Percent, eliminating the need to use I18n pipes.
8. Angular Universal Improvements
For more convenient transfer from the server to the client and back, an API was included. Also, Domino has been added to the platform-server, extending previous capabilities for working with DOM on the server side.
These are just a few of the updates from the latest version of Angular. As we mentioned previously, the Angular 6 release is coming in March. Stay tuned as we’ll have another review of all the features contained in that update as well.