Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 49c42d2

Browse files
committed
refactor(examples): use http
1 parent 7dc7300 commit 49c42d2

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

examples/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function smokeTest() {
7373
var body = Buffer.concat(bodyChunks);
7474
// console.log('GOOD' /*, body.toString()*/ );
7575
// ...and/or process the entire body here.
76-
})
76+
});
7777
});
7878

7979
req.on('error', function(e) {

examples/src/universal/test_page/app.ts

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,17 @@ export class App {
108108
buttonTest: string = '';
109109
testingInput: string = 'default state on component';
110110

111-
// todosObs1$ = this.http.get(App.queries.todos)
112-
// .filter(res => res.status >= 200 && res.status < 300)
113-
// .map(res => res.json())
114-
// .map(data => transformData(data)); // ensure correct data prop types
111+
todosObs1$ = this.http.get(App.queries.todos)
112+
.filter(res => res.status >= 200 && res.status < 300)
113+
.map(res => res.json())
114+
.map(data => transformData(data)); // ensure correct data prop types
115115
todosObs2$ = this.http.get(App.queries.todos)
116116
.filter(res => res.status >= 200 && res.status < 300)
117117
.map(res => res.json())
118118
.map(data => transformData(data)); // ensure correct data prop types
119-
// todosObs3$ = this.http.get(App.queries.todos)
120-
// .map(res => res.json())
121-
// .map(data => transformData(data));
119+
todosObs3$ = this.http.get(App.queries.todos)
120+
.map(res => res.json())
121+
.map(data => transformData(data));
122122

123123
constructor(private http: Http) {
124124

@@ -129,21 +129,21 @@ export class App {
129129
// this.addItem();
130130
// this.addItem();
131131

132-
// this.todosObs1$.subscribe(
133-
// // onValue
134-
// todos => {
135-
// todos.map(todo => this.addItem(todo));
136-
// this.anotherAjaxCall();
137-
// },
138-
// // onError
139-
// err => {
140-
// console.error('err', err);
141-
// throw err;
142-
// },
143-
// // onComplete
144-
// () => {
145-
// console.log('complete request1');
146-
// });
132+
this.todosObs1$.subscribe(
133+
// onValue
134+
todos => {
135+
todos.map(todo => this.addItem(todo));
136+
this.anotherAjaxCall();
137+
},
138+
// onError
139+
err => {
140+
console.error('err', err);
141+
throw err;
142+
},
143+
// onComplete
144+
() => {
145+
console.log('complete request1');
146+
});
147147

148148
this.todosObs2$.subscribe(
149149
// onValue
@@ -164,16 +164,16 @@ export class App {
164164

165165
}
166166
anotherAjaxCall() {
167-
// this.todosObs3$.subscribe(
168-
// todos => {
169-
// console.log('anotherAjaxCall data 3', todos);
170-
// },
171-
// err => {
172-
// console.log('anotherAjaxCall err')
173-
// },
174-
// () => {
175-
// console.log('anotherAjaxCall complete ajax')
176-
// });
167+
this.todosObs3$.subscribe(
168+
todos => {
169+
console.log('anotherAjaxCall data 3', todos);
170+
},
171+
err => {
172+
console.log('anotherAjaxCall err');
173+
},
174+
() => {
175+
console.log('anotherAjaxCall complete ajax');
176+
});
177177
}
178178

179179
log(value) {
@@ -212,5 +212,3 @@ export class App {
212212
}
213213

214214
}
215-
216-

examples/src/universal/test_page/browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ console.timeEnd('angular2/core in client');
55
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
66
import {Http, HTTP_PROVIDERS} from 'angular2/http';
77

8+
import 'rxjs/Rx';
89
// import {
910
// NG_PRELOAD_CACHE_PROVIDERS,
1011
// PRIME_CACHE

0 commit comments

Comments
 (0)