feat(http): add support for JSONP requests

Closes #2905
Closes #2818
This commit is contained in:
Caitlin Potter
2015-07-14 19:53:04 -05:00
parent b4cde697b5
commit 81abc39929
21 changed files with 566 additions and 12 deletions

View 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());
}
}