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, useClass: HttpInterceptingHandler },
HttpXhrBackend,
{ provide: HttpBackend, useExisting: HttpXhrBackend },
BrowserXhr,
{ provide: XhrFactory, useExisting: BrowserXhr },
]
})
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/common/http/HttpClientModule