[英]How to declare Inputs on a component in Angular 2 in ES5?
Angular2's current documentation doesn't provide an example for using @Input
and @Output
in es5 syntax. Angular2的当前文档没有提供在es5语法中使用
@Input
和@Output
的示例。
I'm trying to get an angular2 fiddle up so need to use es5 我试图让一个有角度的小提琴,所以需要使用es5
This is the es2016 version 这是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;
}
Use inputs
and outputs
properties in Component
annotation. 在
Component
注释中使用inputs
和outputs
属性。 See this plunker . 看到这个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;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.