Angular 5 updates

What’s new in Angular 5?

In 2017, Google delivered two new updates to its popular Javascript framework. Angular 4 debuted in March. This version was packed with new features but still compatible with Angular 2. In November, Angular 5 came out with updates that have made it “faster, smaller and easier to use.”

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

Angular CLI 1.5 utilizes a build optimizer tool that is enabled by default. Using semantic understanding, it decreases the size of JavaScript bundles which makes the app lighter and faster.

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 Angular development, thus streamlining the overall process.  

3. preserveWhitespaces

A new preserveWhitespaces option has been added in order to eliminate unnecessary spaces. This helps to reduce the final bundle. Three options are available:

  1. Set it for each component’s decorator.
  2. Turn it on in a tsconfig.json file and enable this option for the whole app.
  3. 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.

5. HttpClient

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.