Angular2's current documentation doesn't provide an example for using @Input
and @Output
in es5 syntax.
I'm trying to get an angular2 fiddle up so need to use es5
This is the es2016 version
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. See this 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;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With