From 860e88c5becd53221e9f54564e430a9df794c0ab Mon Sep 17 00:00:00 2001 From: Gerd Jungbluth Date: Thu, 8 Oct 2015 18:04:22 +0200 Subject: [PATCH] docs(Http): add type annotations to clarify API IMHO this tiny example is easier to read when some type annotations are added and the parameter names are more concise. Closes #4614 --- modules/playground/src/http/http_comp.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/playground/src/http/http_comp.ts b/modules/playground/src/http/http_comp.ts index 04b4110f9d..ccad58c110 100644 --- a/modules/playground/src/http/http_comp.ts +++ b/modules/playground/src/http/http_comp.ts @@ -1,5 +1,5 @@ import {Component, View, NgFor} from 'angular2/angular2'; -import {Http} from 'angular2/http'; +import {Http, Response} from 'angular2/http'; @Component({selector: 'http-app'}) @View({ @@ -14,8 +14,10 @@ import {Http} from 'angular2/http'; ` }) export class HttpCmp { - people: Object; + people: Object[]; constructor(http: Http) { - http.get('./people.json').map(res => res.json()).subscribe(res => this.people = res); + http.get('./people.json') + .map((res: Response) => res.json()) + .subscribe((people: Array) => this.people = people); } }