2016-04-28 17:50:03 -07:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {Jsonp, Response} from '@angular/http/http';
|
|
|
|
import {ObservableWrapper} from '@angular/facade';
|
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">
|
2016-04-25 19:52:24 -07:00
|
|
|
<li *ngFor="let 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
|
|
|
}
|
|
|
|
}
|