From f76eea4f9bb617642ce390539272fbf9edc230af Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Tue, 1 Dec 2015 13:30:14 -0800 Subject: [PATCH] chore(http): update http example to include map operator --- modules/playground/src/http/http_comp.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/playground/src/http/http_comp.ts b/modules/playground/src/http/http_comp.ts index 914a19be42..88e7a2cc5c 100644 --- a/modules/playground/src/http/http_comp.ts +++ b/modules/playground/src/http/http_comp.ts @@ -1,5 +1,6 @@ import {Component, View, NgFor} from 'angular2/angular2'; import {Http, Response} from 'angular2/http'; +import 'rxjs/operators/map'; @Component({selector: 'http-app'}) @View({ @@ -16,6 +17,8 @@ import {Http, Response} from 'angular2/http'; export class HttpCmp { people: Object[]; constructor(http: Http) { - http.get('./people.json').subscribe(res => { this.people = res.json(); }); + http.get('./people.json') + .map((res: Response) => res.json()) + .subscribe((people: Array) => this.people = people); } }