Hi Sander,
Thank you so much for the response!

So, I think I tried that, but I might be misunderstanding.  I am injecting 
my header in all AJAX requests by my application to our REST backend, I did 
this by creating my own AuthorizationHttpClient, that extends the Http 
class provided by @angular/http.  Then in my root module, in my providers 
definition, I replace the Http class with my AuthorizationHttpClient via a 
factory. So, that snippet looks like:

{provide: Http, 
useFactory: httpFactory,
deps: [XHRBackend, RequestOptions, SessionService]
}


My AuthorizationHttpClient then injects my Authorization header with my JWT 
token, and that works great, all requests to my backend REST API have the 
token included. However, Angular doesn't seem to use its Http class (and so 
therefore doesn't use my AuthorizationHttpClient replacement class) when 
performing the loadChildren request to pull the chunked files, I've 
debugged it down to a very low level call in the Module loader that uses a 
System.import().

Am I understanding your suggestion properly?

Thank you!
Brian



On Monday, September 18, 2017 at 11:48:27 PM UTC-5, Sander Elias wrote:
>
> Hi Brian,
>
> There are multiple ways to solve this problem. In most apps, I create my 
> own http service(s), that takes care of all the "special requirements" for 
> that app. (of course, I use the httpClient in there). I inject this in the 
> module that is bootstrapped. That way you can just inject it where you need 
> it. I. Larger apps even have more as one. For example, one for a special 
> 3rth party service, and one for the private part of my own api's 
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to