HttpClientModule
class
npm Package | @angular/common |
---|---|
Module | import { HttpClientModule } from '@angular/common/http'; |
Source | common/http/src/module.ts |
Overview
class HttpClientModule { }
Description
NgModule
which provides the HttpClient
and associated services.
Interceptors can be added to the chain behind HttpClient
by binding them to the multiprovider for HTTP_INTERCEPTORS
.
Annotations
@NgModule({
imports: [
HttpClientXsrfModule.withOptions({
cookieName: 'XSRF-TOKEN',
headerName: 'X-XSRF-TOKEN'
}),
],
providers: [
HttpClient,
{
provide: HttpHandler,
useFactory: interceptingHandler,
deps: [HttpBackend, [new Optional(), new Inject(HTTP_INTERCEPTORS)]]
},
HttpXhrBackend,
{ provide: HttpBackend, useExisting: HttpXhrBackend },
BrowserXhr,
{ provide: XhrFactory, useExisting: BrowserXhr },
]
})
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v4.angular.io/api/common/http/HttpClientModule