Sharing Top Content from the Angular-sphere.

Angular2 DI Service Decorator · Captain Codeman

  • The trick is to create a new DI token for the base Http class and then use the Http class as the token for the wrapped or decorated instance.
  • Angular2 provides an out-of-the-box service for making http requests which replaces the old $resource module of Angular 2 – just create a class and inject the Http instance into it and then use that in it’s methods to create the service you need.
  • We’d now be coupled to the AuthHttp class as well as the Http class so couldn’t just use our service elsewhere without pulling that in also (along with whatever dependencies it uses).

Read the full article, click here.


@ATL_AngularJS: “#Angular2 Dependency Injection Service Decorator #AngularJS”


Software Development & Cloud Architecture Blog


Angular2 DI Service Decorator · Captain Codeman

Comments are closed, but trackbacks and pingbacks are open.