mardi 3 février 2015

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?





Aucun commentaire:

Enregistrer un commentaire