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