Created
February 26, 2017 14:06
-
-
Save brettwold/b8c4093ecb75ad2ec74d93783590d64a to your computer and use it in GitHub Desktop.
Adding HttpAuthInterceptor to @NgModule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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