Created
November 1, 2017 08:19
-
-
Save bbogdanov/5ba35a620190274c4ed2c2645d86a39d to your computer and use it in GitHub Desktop.
Extending Angular HttpClient app.module
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
import { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { ApplicationHttpClient, applicationHttpClientCreator } from './http-client'; | |
import { AppComponent } from './app.component'; | |
import { HttpClient } from '@angular/common/http'; | |
@NgModule({ | |
declarations: [ | |
AppComponent, | |
], | |
imports: [ | |
BrowserModule, | |
HttpClientModule, | |
], | |
providers: [ | |
// Providing the ApplicationHttpClient so it could be used as a service. | |
{ | |
provide: ApplicationHttpClient, | |
useFactory: applicationHttpClientCreator, | |
deps: [HttpClient] | |
}, | |
], | |
bootstrap: [AppComponent] | |
}) | |
export class AppModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment