b3d98cba77
The BaseRequestOptions class is responsible for declaring default values, while the RequestOptions class is merely responsible for setting values based on values provided in the constructor.
23 lines
550 B
TypeScript
23 lines
550 B
TypeScript
import {Component, View, NgFor} from 'angular2/angular2';
|
|
import {Http} from 'angular2/http';
|
|
import {ObservableWrapper} from 'angular2/src/facade/async';
|
|
|
|
@Component({selector: 'http-app'})
|
|
@View({
|
|
directives: [NgFor],
|
|
template: `
|
|
<h1>people</h1>
|
|
<ul class="people">
|
|
<li *ng-for="#person of people">
|
|
hello, {{person['name']}}
|
|
</li>
|
|
</ul>
|
|
`
|
|
})
|
|
export class HttpCmp {
|
|
people: Object;
|
|
constructor(http: Http) {
|
|
ObservableWrapper.subscribe(http.get('./people.json'), res => this.people = res.json());
|
|
}
|
|
}
|