user2521436
user2521436

Reputation: 299

What is the difference between the function Ember.computed() and function().property()?

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

Answers (1)

Salah Eddine Taouririt
Salah Eddine Taouririt

Reputation: 26415

Ember.computed() is an (clean) alternative to function().property() in case you are disabling prototype extensions.

Upvotes: 1

Related Questions