Slide 52
Slide 52 text
COMPUTED PROPERTIES
class XCustom extends Polymer.Element {
static get properties() {
return {
first: String,
last: String,
fullName: {
type: String,
computed: 'computeFullName(first, last)'
}
}
}
}
My name is {{fullName}}
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
firstName: null,
lastName: null,
fullName: computed('firstName', 'lastName', function() {
return `${this.get('firstName')} {this.get('lastName')}`;
})
});