X Tutup
Skip to content

Commit f76eea4

Browse files
jeffbcrossjelbourn
authored andcommitted
chore(http): update http example to include map operator
1 parent 5514dc1 commit f76eea4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/playground/src/http/http_comp.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Component, View, NgFor} from 'angular2/angular2';
22
import {Http, Response} from 'angular2/http';
3+
import 'rxjs/operators/map';
34

45
@Component({selector: 'http-app'})
56
@View({
@@ -16,6 +17,8 @@ import {Http, Response} from 'angular2/http';
1617
export class HttpCmp {
1718
people: Object[];
1819
constructor(http: Http) {
19-
http.get('./people.json').subscribe(res => { this.people = res.json(); });
20+
http.get('./people.json')
21+
.map((res: Response) => res.json())
22+
.subscribe((people: Array<Object>) => this.people = people);
2023
}
2124
}

0 commit comments

Comments
 (0)
X Tutup