Skip to content

Instantly share code, notes, and snippets.

@brettwold
Created February 26, 2017 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettwold/b8c4093ecb75ad2ec74d93783590d64a to your computer and use it in GitHub Desktop.
Save brettwold/b8c4093ecb75ad2ec74d93783590d64a to your computer and use it in GitHub Desktop.
Adding HttpAuthInterceptor to @NgModule
export function getHttpAuth(backend: ConnectionBackend, defaultOptions: RequestOptions, storage: Storage) {
return new HttpAuth(backend, defaultOptions, storage);
}
@NgModule({
...
providers: [
{
provide: Http,
useFactory: getHttpAuth,
deps: [XHRBackend, RequestOptions, Storage]
},
...
]
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment