7 Features of Angular 5.1 You Need to Know

Angular is an all-encompassing JavaScript framework used for building web, desktop, and mobile applications. After two major upgrades in the last 14 months, Angular has released its latest version Angular 5, in November 2017. Released in December 2017, Angular 5.1 is a minor release containing several smaller features and bugfixes. The previous version of Angular was 4.4.0. This latest version of Angular 5.1 is focused more on making Angular smaller and faster to use. Let’s have a look at the major changes in this version.

1. A new HttpClient

In previous angular version @angular/http module was used for making HTTP requests in Angular applications. In angular 5, the HttpClient API from @angular/common/http package is now recommended for use.  Some of the HttpClient API features are –

  1. Synchronous & typed response body access.
  2. JSON is an assumed default, which means no  need to explicitly parsed.
  3. Immutable request objects.

2. Angular Material & CDK Stable Release

After releases of 11 alpha, 12 beta, the Angular Material and the Angular CDK was released. Angular Material is based on Google’s Material Design visual language. It offers 30 UI components for your Angular applications along with the Angular CDK (Component Dev Kit).

3. Multiple Names are Supported for Components and Directives

In angular 5.1, multiple names can be given to components and directives while exporting. It helps to migrate without breaking changes.

4. Increased standardisation across browsers

The standardization across browsers in Angular 5 has eliminated the need for i18n polyfills with new number, date, and currency pipes in it. These pipes provide extensive support and configurations for locales. In case, if you want to use use the old pipes, do import the DeprecatedI18NPipesModule after the CommonModule.

5. Improved Decorator Error Messages

Decorators are produced by compilers. This feature have been significantly improved and fixes the issue even if a decorator contain unsupported or incorrect expressions.

For example, calling a function to produce a template is not supported:

 template: genTemplate()
export class MyComponent {}

In the previous version, this would yield an error:

Error encountered resolving symbol values statically. Calling function ‘genTemplate’, function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol MyComponent in components.ts, resolving symbol MyComponent in components.ts

In the present version, this error has been fixed:

component.ts(9,16): Error during template compile of ‘MyComponent’.

 Function calls are not supported in decorators but ‘genTemplate’ was called.

6. Service Worker Support in the CLI

Angular 5.0.0 has new service worker implementation customized especially for Angular applications. Using @angular/service-worker can improve the loading performance of browser application which supports API

7. Improved Universal & AppShell Support in the CLI

Angular CLI 1.6 provides better support for adding Universal to existing projects via Schematics.

Angular Universe

Use the following commands to add Universal in current CLI application –

ng generate universal <name>

You can replace <name> with the desired name for your universal app.

To build Universal app, run the command:

ng build –app=<name>

App Shell

Another important feature is the App Shell support.

Angular 6 is on the Horizon

Google will release Angular 6 in March or April 2018. Google claims that even though Angular 6 will repeat themes of Angular 5, it will make developer’s lives easier, making it possible to deliver apps better for their users.

About Payel Bhowmick

The author is an analyst at SpringPeople & writes on emerging technology trends for IT professionals. Passionate about technology, her current area of focus is the digital revolution currently underway in the edu-tech industry. When not at work, Payel splits her time between writing, reading and watching sci-fi movies.

Posts by Payel Bhowmick

Leave a Reply

Your email address will not be published. Required fields are marked *