如何在ES5中的Angular 2中声明组件的输入?

Che*_*aks 9 angular

Angular2的当前文档没有提供使用@Input@Output在es5语法中的示例.

我试图让一个有角度的小提琴,所以需要使用es5

这是es2016版本

class BankAccount {
  @Input() bankName: string;
  @Input('account-id') id: string;
  // this property is not bound, and won't be automatically updated by Angular
  normalizedBankName: string;
}
Run Code Online (Sandbox Code Playgroud)

ale*_*ods 13

注释中的使用inputsoutputs属性Component.看到这个plunker.

var BankAccount = ng
  .Component({
    selector: 'bank-account',
    template: '<b>{{ bankName }}<b><span>{{ id }}',
    inputs: [
      'bankName', 
      'id: accountId'
    ]
  })
  .Class({
    constructor: function() {
      this.bankName = null;
      this.id = null;
    }
  });
Run Code Online (Sandbox Code Playgroud)