Reputation: 299
App.Person = Ember.Object.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName'),
fullName:Ember.computed('firstName','lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
}
});
What is the difference between the function Ember.computed() or function().property()?
Why there are two ways (functions) to declares the function to be a computed property? What are the differences, benefits?
Upvotes: 0
Views: 323
Reputation: 26415
Ember.computed()
is an (clean) alternative to function().property()
in case you are disabling prototype extensions.
Upvotes: 1