This working code uses Sproutcore:
person = SC.Object.create({
firstName: 'Foo',
lastName: 'Bar',
fullName: function() {
return this.get('firstName') + " " + this.get('lastName');
}.property()
});
console.log(person.get('fullName'));
I wonder where property () is declared and how they made it work. When I try to restore this without an SC class, it gives me:
TypeError: Object function () {
return this.get('firstName') + " " + this.get('lastName');
} has no method 'property'
What does the code look like to make it work?
ajsie source
share