Categories :

What’s New in Angular 5

The transition from AngularJS to Angular 2 was a huge step forward. At the same time everything has changed, without backwards compatibility. At the same time, Angular 4 added new features, but it was backward compatible with Angular 2 (Angular 3 version was missed due to @ angular / router, which at the time of release was 3.x, while the remaining packets were 2.x. In order to avoid confusion and translate all packages to one version, the third version was skipped). Angular 5 is the next update, in which the changes have affected the mechanisms working under the hood.

Many ITVDN users are asking about the relevance of the curriculum of the Angular Essential video course, which is recorded using version 2 and the video course Angular Advanced (version 4). Angular 5 is not something completely new, it is an improvement to the existing framework. To understand and start using the features that appeared in the fifth version, you need to know the basics that have not changed since the second version.

What’s new in Angular 5?

Improved compiler. In Angular 4, the compiler recompiled all the files with each change. In Angular 5, the compiler only works with those files in which there are changes, which means that the time for compilation of the project as a whole has significantly decreased.

Optimized build. In the Angular CLI, using production build in conjunction with the Angular 5 version, by default, the build optimizer will be used, which can significantly reduce its size by using semantic analysis of the application code.

Emphasis on simplifying the development of PWA (Progressive Web Apps). PWA are applications that combine the best that there is in web applications and the best that is available in mobile applications.

  • PWA works regardless of the selected browser;
  • adapt for the device – desktop, tablet, phone;
  • can work without connecting to the Internet or in case of communication failure;
  • look like an application installed on the device;
  • thanks to Service Worker contain up-to-date updated information;
  • They are safe, because they work through HTTPS;
  • use features like push notifications;
  • Installable – allow the user to add the application to the device’s home screen.

Support for TypeScript 2.4. Angular 5 supports the TypeScript 2.4 version, which makes it possible to use the new TS features: enumerations based on strings, improved type checking when working with generic types, week-type-detection.

Pipes, adapted for localization. Updated Pipes for Date, Currency, Number and Percent, there is no need to use i18n.

New Events Router. Using the ActivationStart and ActivationEnd or ChildActivationStart and ChildActivationEnd events, you can organize the display of the download indicators when you change the route.

HttpClient. A new HttpClient was added in version 4.3, the old http client is marked as depreceted in the new version. In Angular 6, the old client will be deleted. From the advantages of the new client, you can single out the independent extraction of JSON without the need to explicitly apply the map method and the ability to use interceptors.

Validation of forms. Now when working with forms, using the update On property, you can determine at what point the check will occur – to the blur or submit event (instead of checking for each input event).

Replace ReflectiveInjector with StaticInjector. Changed the mechanism for introducing dependencies. The new StaticInjector does not need the Reflect polyfill (but when using JIT, the polyfill data will still need to be used), which can reduce the size of the application.

Angular CLI 1.5 uses Angular version 5.

Improvement of NgZone. NgZone has become even faster, and the library can also be disabled to use another library to improve performance.

Improved RxJS. Support is updated to version 5.5.2 and higher. Support for new pipable operators.

Angular 5 turned out to be compact and faster than its predecessors, and it did not do without new features. The launch of the next version of Angular is scheduled for March 28, 2018. We will wait for improvements and new opportunities from the Angular team.