Created
July 23, 2012 18:59
-
-
Save hyperqube/3165433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: