2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-04-28 17:50:03 -07:00
|
|
|
import {Component} from '@angular/core';
|
2019-04-26 16:49:50 -07:00
|
|
|
import {Jsonp} from '@angular/http';
|
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">
|
2019-04-26 16:49:50 -07:00
|
|
|
hello, {{person['name']}}
|
2015-07-14 19:53:04 -05:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class JsonpCmp {
|
2019-04-26 16:49:50 -07:00
|
|
|
people: Object;
|
|
|
|
constructor(jsonp: Jsonp) {
|
|
|
|
jsonp.get('./people.json?callback=JSONP_CALLBACK').subscribe(res => this.people = res.json());
|
2015-07-14 19:53:04 -05:00
|
|
|
}
|
|
|
|
}
|