angular / 5 / api / common / http / testing / httpclienttestingmodule.html

HttpClientTestingModule

class

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