1

The main purpose of customizing the http class is to add an unique parameter to every GET request to make the whole url unique and prevent browsers to use cache while retrieving templates, scripts, styles and any other data that my app gets from server (except 'node_modules').

I know how to use custom http class to make calls inside my app, but what I want is to make Angular engine, which loads app's resources, use my class.

I used interceptors to do the same in AngularJS and this solution worked just perfect.

Is this possible at all?

Vadim Panov
  • 341
  • 2
  • 7

1 Answers1

0

yes it is possible. You can extend the http class and then override. In your case you want to override the GET method.

Once you have done this, you "provide" the HTTP class as your class.

See this post for more implementation details .. What is httpinterceptor equivalent in angular2?

Community
  • 1
  • 1
danday74
  • 52,471
  • 49
  • 232
  • 283
  • Thank you for response. I am using the method you suggested, but it works only for **my own** requests to the server. The question was "how to make Angular / SystemJS engine to use this overriden class to load all my html templates and node_modules". – Vadim Panov Mar 31 '17 at 21:35
  • ok i think you want use this class to load all ng2 files during bootstrapping. I am not sure this is possible. I certainly do not know how. All the best. – danday74 Mar 31 '17 at 21:52