2015-12-10 16:24:34 +01:00
|
|
|
import {Component} from 'angular2/core';
|
2015-08-20 14:28:25 -07:00
|
|
|
import {Jsonp, Response} from 'angular2/http';
|
2015-11-06 17:34:07 -08:00
|
|
|
import {ObservableWrapper} from 'angular2/src/facade/async';
|
2015-07-14 19:53:04 -05:00
|
|
|
|
2015-12-10 16:24:34 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'jsonp-app',
|
2015-07-14 19:53:04 -05:00
|
|
|
template: `
|
|
|
|
<h1>people</h1>
|
|
|
|
<ul class="people">
|
2015-11-23 16:02:19 -08:00
|
|
|
<li *ngFor="#person of people">
|
2015-07-14 19:53:04 -05:00
|
|
|
hello, {{person['name']}}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class JsonpCmp {
|
|
|
|
people: Object;
|
|
|
|
constructor(jsonp: Jsonp) {
|
2015-09-25 18:53:32 -04:00
|
|
|
jsonp.get('./people.json?callback=JSONP_CALLBACK').subscribe(res => this.people = res.json());
|
2015-07-14 19:53:04 -05:00
|
|
|
}
|
|
|
|
}
|