linkHttpClientTestingModule
| npm Package | @angular/common |
|---|---|
| Module | import { HttpClientTestingModule } from '@angular/common/http/testing'; |
| Source | common/http/testing/src/module.ts |
linkOverview
class HttpClientTestingModule {
}
linkDescription
Configures HttpClientTestingBackend as the HttpBackend used by HttpClient.
Inject HttpTestingController to expect and flush requests in your tests.
linkAnnotations
@NgModule({
imports: [
HttpClientModule,
],
providers: [
HttpClientTestingBackend,
{ provide: HttpBackend, useExisting: HttpClientTestingBackend },
{ provide: HttpTestingController, useExisting: HttpClientTestingBackend },
]
})