23
modules/examples/src/jsonp/jsonp_comp.ts
Normal file
23
modules/examples/src/jsonp/jsonp_comp.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {Component, View, NgFor} from 'angular2/angular2';
|
||||
import {Jsonp} from 'angular2/http';
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
@Component({selector: 'jsonp-app'})
|
||||
@View({
|
||||
directives: [NgFor],
|
||||
template: `
|
||||
<h1>people</h1>
|
||||
<ul class="people">
|
||||
<li *ng-for="#person of people">
|
||||
hello, {{person['name']}}
|
||||
</li>
|
||||
</ul>
|
||||
`
|
||||
})
|
||||
export class JsonpCmp {
|
||||
people: Object;
|
||||
constructor(jsonp: Jsonp) {
|
||||
ObservableWrapper.subscribe(jsonp.get('./people.json?callback=JSONP_CALLBACK'),
|
||||
res => this.people = res.json());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user