BT

InfoQ Homepage News Angular 4.3 Brings New HttpClient and More

Angular 4.3 Brings New HttpClient and More

Leia em português

This item in japanese

Bookmarks

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
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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.