angular-docs-cn/aio/content/examples/upgrade-phonecat-2-hybrid/app/phone-list/phone-list.component.ajs.ts

25 lines
530 B
TypeScript
Raw Normal View History

// #docregion
declare var angular: angular.IAngularStatic;
import { Phone, PhoneData } from '../core/phone/phone.service';
class PhoneListController {
phones: PhoneData[];
orderProp: string;
static $inject = ['phone'];
constructor(phone: Phone) {
phone.query().subscribe(phones => {
this.phones = phones;
});
this.orderProp = 'age';
}
}
angular.
module('phoneList').
component('phoneList', {
templateUrl: 'app/phone-list/phone-list.template.html',
controller: PhoneListController
});