We will discuss a couple of things that have changed and some new things that were added in Angular version 5
1. Angular Form Validation:
Angular Form Validation has also been updated because of problems relating to it in the versions, especially in template driven forms. The Validations on forms is used to run on ‘blur’ events on every input, so by clicking on the field and clicking out without entering enough characters caused a ‘blur’ event and give an error. In the new version of Angular version 5, this ‘blur’ event can be specified when submission of form i.e. on the ‘on submits’ event.
2. New Router Lifecycle Events:
The Angular Version 5, It has added new Lifecycle Events for routers and provides the capability of specifying certain points in loading components which can now be done through routers. It has the ability to show spinners when a child component is loading or to measure the performance of router guards, like for Authentication guards etc. The events that can be used in Angular 5 are:
3. Angular Universal Transfer API
In Angular Version 5, The Angular Universal team has added the Domino to the platform-server. It simply means more DOM manipulations can be done out of the box within server-side contexts and apart from this, two modules ServerTransferStateModule and BrowserTransferModule have been added to Angular Universal and allow you to generate information as part of your rendering with platform-server and then transfer it to the client-side to avoid regeneration of the same information.
4. Faster Compiler in Angular 5:
A lot of improvements have been added to the Angular compiler to make it faster. Now, The Angular compiler leverages TypeScript transforms. You can take advantage of it by running:
- ng serve –aot
5. Progressive Web Applications:
Another update in Angular Version 5 is Progressive Web Applications (PWA). In previous versions of Angular, building PWAs were complex and there were many caveats that one needed to handle when developing and deploying Angular PWAs.
Now, In Angular Version 5, creating a PWA is now easier than it used to be. Angular uses the @angular/service-workers module. Right now, PWA is not the default mode but it will be in future releases.
6. Internationalization Improvement:
In previous versions of Angular used to rely on the browser APIs for currency, date and number formatting and this led to many inconsistencies and a growth of many polyfills due to different implementation across different browsers.
The Intl-API is no longer supported. Now, localization is based on data from the Unicode Common Locale Data Repository (CLDR). The format of this is now consistent and browser independent and will remove the need for polyfills.
7. Support for Multiple Export Alias in Angular version 5
In Angular Version 5, you can give multiple names to your components and directives while exporting. Sending out a part with numerous names can enable your clients to relocate without breaking changes.
8. Build Optimization
The Angular team focused on making Angular Version 5 faster, smaller, and easier to use and production builds created with the Angular CLI will now apply to the build optimizer by default. The build optimizer removes the Angular decorators from your application’s runtime codes and reducing the size of your bundle and increasing the boot speed of your application. This action leads to a less bundle size and faster application speed.
Angular Version 5 is a great update and recommended that you update your applications to use it. The update comes with very useful tools that will definitely build your application faster and generally more optimized.