Skip to content

Instantly share code, notes, and snippets.

@hyperqube
Created July 23, 2012 18:59
Show Gist options
  • Save hyperqube/3165433 to your computer and use it in GitHub Desktop.
Save hyperqube/3165433 to your computer and use it in GitHub Desktop.
MyApp.president = Ember.Object.create({
firstName: "Barack",
lastName: "Obama",
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
// Tell Ember that this computed property depends on firstName
// and lastName
}.property('firstName', 'lastName')
});
@hyperqube
Copy link
Author

Many computed properties have dependencies on other properties. For example, in the above example, the fullName property depends on firstName and lastName to determine its value. You can tell Ember about these dependencies like this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment