ComputedProperty#property()

property (path) Ember.ComputedPropertypublic

Defined in packages/ember-metal/lib/computed.js:220

Sets the dependent keys on this computed property. Pass any number of arguments containing key paths that this computed property depends on.

let President = Ember.Object.extend({
  fullName: Ember.computed(function() {
    return this.get('firstName') + ' ' + this.get('lastName');

    // Tell Ember that this computed property depends on firstName
    // and lastName
  }).property('firstName', 'lastName')
});

let president = President.create({
  firstName: 'Barack',
  lastName: 'Obama'
});

president.get('fullName'); // 'Barack Obama'

Parameters:

path String
zero or more property paths

Returns:

Ember.ComputedProperty
this
doc_EmberJs
2016-11-30 16:48:51
Comments
Leave a Comment

Please login to continue.