Revert "refactor: use new Http library in playground (#29355)"
This reverts commit acfcf90528
.
This commit is contained in:
@ -6,12 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
interface Person {
|
||||
name: string;
|
||||
}
|
||||
import {Jsonp} from '@angular/http';
|
||||
|
||||
@Component({
|
||||
selector: 'jsonp-app',
|
||||
@ -19,14 +15,14 @@ interface Person {
|
||||
<h1>people</h1>
|
||||
<ul class="people">
|
||||
<li *ngFor="let person of people">
|
||||
hello, {{person.name}}
|
||||
hello, {{person['name']}}
|
||||
</li>
|
||||
</ul>
|
||||
`
|
||||
})
|
||||
export class JsonpCmp {
|
||||
people: Person[];
|
||||
constructor(http: HttpClient) {
|
||||
http.jsonp('./people.json', 'callback').subscribe(res => this.people = res);
|
||||
people: Object;
|
||||
constructor(jsonp: Jsonp) {
|
||||
jsonp.get('./people.json?callback=JSONP_CALLBACK').subscribe(res => this.people = res.json());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user