On this page
HttpClientTestingModule
class
npm Package | @angular/common |
---|---|
Module | import { HttpClientTestingModule } from '@angular/common/http/testing'; |
Source | common/http/testing/src/module.ts |
Overview
class HttpClientTestingModule {
}
Description
Configures HttpClientTestingBackend
as the HttpBackend
used by HttpClient
.
Inject HttpTestingController
to expect and flush requests in your tests.
Annotations
@NgModule({ imports: [ HttpClientModule, ], providers: [ HttpClientTestingBackend, { provide: HttpBackend, useExisting: HttpClientTestingBackend }, { provide: HttpTestingController, useExisting: HttpClientTestingBackend }, ] })
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/common/http/testing/HttpClientTestingModule