docs(http): fix example usage of MockBackend
This commit is contained in:
parent
f2c7946cca
commit
aa8c5aa2e2
|
@ -131,7 +131,8 @@ export class MockBackend implements ConnectionBackend {
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {MockBackend, Http, BaseRequestOptions} from 'angular2/http';
|
* import {Http, BaseRequestOptions} from 'angular2/http';
|
||||||
|
* import {MockBackend} from 'angular2/http/testing';
|
||||||
* import {Injector} from 'angular2/core';
|
* import {Injector} from 'angular2/core';
|
||||||
*
|
*
|
||||||
* it('should get a response', () => {
|
* it('should get a response', () => {
|
||||||
|
@ -139,7 +140,7 @@ export class MockBackend implements ConnectionBackend {
|
||||||
* var text; //this will be set from mock response
|
* var text; //this will be set from mock response
|
||||||
* var injector = Injector.resolveAndCreate([
|
* var injector = Injector.resolveAndCreate([
|
||||||
* 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);
|
||||||
|
|
Loading…
Reference in New Issue