docs(http): fix MockBackend example
imports & syntax error fix Closes #7383
This commit is contained in:
parent
fba0e2ff12
commit
17f73cb7bc
|
@ -131,9 +131,9 @@ export class MockBackend implements ConnectionBackend {
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Http, BaseRequestOptions} from '@angular/http';
|
* import {Http, BaseRequestOptions, Response} from '@angular/http';
|
||||||
* import {MockBackend} from '@angular/http/testing';
|
* import {MockBackend} from '@angular/http/testing';
|
||||||
* import {Injector} from '@angular/core';
|
* import {Injector, provide} from '@angular/core';
|
||||||
*
|
*
|
||||||
* it('should get a response', () => {
|
* it('should get a response', () => {
|
||||||
* var connection; //this will be set when a new connection is emitted from the backend.
|
* var connection; //this will be set when a new connection is emitted from the backend.
|
||||||
|
@ -142,7 +142,7 @@ export class MockBackend implements ConnectionBackend {
|
||||||
* MockBackend,
|
* MockBackend,
|
||||||
* provide(Http, {useFactory: (backend, options) => {
|
* provide(Http, {useFactory: (backend, options) => {
|
||||||
* return new Http(backend, options);
|
* return new Http(backend, options);
|
||||||
* }, deps: [MockBackend, BaseRequestOptions]}]);
|
* }, deps: [MockBackend, BaseRequestOptions]})]);
|
||||||
* var backend = injector.get(MockBackend);
|
* var backend = injector.get(MockBackend);
|
||||||
* var http = injector.get(Http);
|
* var http = injector.get(Http);
|
||||||
* backend.connections.subscribe(c => connection = c);
|
* backend.connections.subscribe(c => connection = c);
|
||||||
|
|
Loading…
Reference in New Issue