docs(http) remove .toRx() from http calls

Closes #4578
This commit is contained in:
Eric Mendes Dantas 2015-10-07 07:41:27 -03:00
parent 04b3dee667
commit 21b53c3143
5 changed files with 11 additions and 11 deletions

View File

@ -69,7 +69,7 @@ export {URLSearchParams} from './src/http/url_search_params';
* export class App { * export class App {
* people: Object[]; * people: Object[];
* constructor(http:Http) { * constructor(http:Http) {
* http.get('people.json').toRx().subscribe(res => { * http.get('people.json').subscribe(res => {
* this.people = res.json(); * this.people = res.json();
* }); * });
* } * }
@ -195,7 +195,7 @@ export const HTTP_BINDINGS: any[] = [
* export class App { * export class App {
* people: Array<Object>; * people: Array<Object>;
* constructor(jsonp:Jsonp) { * constructor(jsonp:Jsonp) {
* jsonp.request('people.json').toRx().subscribe(res => { * jsonp.request('people.json').subscribe(res => {
* this.people = res.json(); * this.people = res.json();
* }) * })
* } * }

View File

@ -47,8 +47,8 @@ export class MockConnection implements Connection {
* *
* ``` * ```
* var connection; * var connection;
* backend.connections.toRx().subscribe(c => connection = c); * backend.connections.subscribe(c => connection = c);
* http.request('data.json').toRx().subscribe(res => console.log(res.text())); * http.request('data.json').subscribe(res => console.log(res.text()));
* connection.mockRespond(new Response('fake response')); //logs 'fake response' * connection.mockRespond(new Response('fake response')); //logs 'fake response'
* ``` * ```
* *
@ -108,8 +108,8 @@ export class MockConnection implements Connection {
* var http = injector.get(Http); * var http = injector.get(Http);
* var backend = injector.get(MockBackend); * var backend = injector.get(MockBackend);
* //Assign any newly-created connection to local variable * //Assign any newly-created connection to local variable
* backend.connections.toRx().subscribe(c => connection = c); * backend.connections.subscribe(c => connection = c);
* http.request('data.json').toRx().subscribe((res) => { * http.request('data.json').subscribe((res) => {
* expect(res.text()).toBe('awesome'); * expect(res.text()).toBe('awesome');
* async.done(); * async.done();
* }); * });
@ -142,8 +142,8 @@ export class MockBackend implements ConnectionBackend {
* }, [MockBackend, BaseRequestOptions]]); * }, [MockBackend, BaseRequestOptions]]);
* var backend = injector.get(MockBackend); * var backend = injector.get(MockBackend);
* var http = injector.get(Http); * var http = injector.get(Http);
* backend.connections.toRx().subscribe(c => connection = c); * backend.connections.subscribe(c => connection = c);
* http.request('something.json').toRx().subscribe(res => { * http.request('something.json').subscribe(res => {
* text = res.text(); * text = res.text();
* }); * });
* connection.mockRespond(new Response({body: 'Something'})); * connection.mockRespond(new Response({body: 'Something'}));

View File

@ -101,7 +101,7 @@ export class XHRConnection implements Connection {
* }) * })
* class MyComponent { * class MyComponent {
* constructor(http:Http) { * constructor(http:Http) {
* http('people.json').toRx().subscribe(res => this.people = res.json()); * http('people.json').subscribe(res => this.people = res.json());
* } * }
* } * }
* ``` * ```

View File

@ -42,7 +42,7 @@ import {
* *
* var injector = Injector.resolveAndCreate([HTTP_BINDINGS, AutoAuthenticator]); * var injector = Injector.resolveAndCreate([HTTP_BINDINGS, AutoAuthenticator]);
* var authenticator = injector.get(AutoAuthenticator); * var authenticator = injector.get(AutoAuthenticator);
* authenticator.request('people.json').toRx().subscribe(res => { * authenticator.request('people.json').subscribe(res => {
* //URL should have included '?password=123' * //URL should have included '?password=123'
* console.log('people', res.json()); * console.log('people', res.json());
* }); * });

View File

@ -15,7 +15,7 @@ import {isJsObject} from './http_utils';
* #Example * #Example
* *
* ``` * ```
* http.request('my-friends.txt').toRx().subscribe(response => this.friends = response.text()); * http.request('my-friends.txt').subscribe(response => this.friends = response.text());
* ``` * ```
* *
* The Response's interface is inspired by the Response constructor defined in the [Fetch * The Response's interface is inspired by the Response constructor defined in the [Fetch