BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Angular 4.3 Brings New HttpClient and More

| by Sergio De Simone Follow 4 Followers on Jul 19, 2017. Estimated reading time: 1 minute |

Angular 4.3, the last 4.x release before Angular 5, is a drop-in replacement for previous versions and includes a number of new features, including a new HttpClient module, new router life cycle events, and more.

As mentioned, one of the major new features in Angular 4.3 is the HttpClient module, a complete rewrite of the old Http module bringing three significant improvements:

  • Responses provide access to a .json attribute that makes away with the requirement of explicit parsing the textual response.
  • A new generic mechanism to handle requests and responses using interceptors. To build an interceptor, you declare a class that implements the HttpInterceptor interface, then you chain it to the other interceptors responsible to handle the request or response.
  • Progress events to track both request upload and response download.

According to Angular contributor Cédric Exbrayat, migrating existing code to the new HttpClient module is fairly easy and mostly entails deleting code that is not required anymore.

Angular 4.3 also adds router-level events for GuardsCheck and Resolve, including ResolveStart, ResolveEnd, GuardsCheckStart, and GuardsCheckEnd. Those events are useful if you need to know when a resolver or a guard is run. Additionally, version 4.3 adds a new ::ng-deep alias for the /deep/ CSS selector, which can be used to force a style down to child components. This is mostly due to /deep/ being deprecated in Chrome and removed from all major browsers.

Finally, the ngc compiler has been modified to integrate with TypeScript 2.3 transformers concept. TypeScript transformers are plugins that are applied to the code compiled by tsc. With the changes in Angular 4.3, ngc is now a plugin called by tsc, rather than a wrapper around tsc. This should improve diagnostics and make it easier to refer to the exact line where type-checking fails in Angular source files.

You can read the full list of changes in Angular 4.3 for more details.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT