X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/angular2/src/http/backends/mock_backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class MockConnection implements Connection {
*
* ```
* var connection;
* backend.connections.subscribe(c => connection = c);
* http.request('data.json').subscribe(res => console.log(res.text()));
* backend.connections.toRx().subscribe(c => connection = c);
* http.request('data.json').toRx().subscribe(res => console.log(res.text()));
* connection.mockRespond(new Response('fake response')); //logs 'fake response'
* ```
*
Expand Down Expand Up @@ -117,8 +117,8 @@ export class MockConnection implements Connection {
* var http = injector.get(Http);
* var backend = injector.get(MockBackend);
* //Assign any newly-created connection to local variable
* backend.connections.subscribe(c => connection = c);
* http.request('data.json').subscribe((res) => {
* backend.connections.toRx().subscribe(c => connection = c);
* http.request('data.json').toRx().subscribe((res) => {
* expect(res.text()).toBe('awesome');
* async.done();
* });
Expand Down Expand Up @@ -151,8 +151,8 @@ export class MockBackend implements ConnectionBackend {
* }, [MockBackend, BaseRequestOptions]]);
* var backend = injector.get(MockBackend);
* var http = injector.get(Http);
* backend.connections.subscribe(c => connection = c);
* http.request('something.json').subscribe(res => {
* backend.connections.toRx().subscribe(c => connection = c);
* http.request('something.json').toRx().subscribe(res => {
* text = res.text();
* });
* connection.mockRespond(new Response({body: 'Something'}));
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/http/backends/xhr_backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class XHRConnection implements Connection {
* })
* class MyComponent {
* constructor(http:Http) {
* http('people.json').subscribe(res => this.people = res.json());
* http('people.json').toRx().subscribe(res => this.people = res.json());
* }
* }
* ```
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/http/base_request_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class RequestOptions {
* constructor(baseRequestOptions:BaseRequestOptions, http:Http) {
* var options = baseRequestOptions.merge({body: 'foobar', url: 'https://foo'});
* var request = new Request(options);
* http.request(request).subscribe(res => this.bars = res.json());
* http.request(request).toRx().subscribe(res => this.bars = res.json());
* }
* }
*
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/http/static_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {isJsObject} from './http_utils';
* #Example
*
* ```
* http.request('my-friends.txt').subscribe(response => this.friends = response.text());
* http.request('my-friends.txt').toRx().subscribe(response => this.friends = response.text());
* ```
*
* The Response's interface is inspired by the Response constructor defined in the [Fetch
Expand Down
X Tutup