11
var App = Ember.Application.create();
App.Person = Em.Object.extend({
firstName: null,
lastName: null,
fullName: function(){
return this.get('firstName') + " " + this.get('lastName');
}.property('firstName', 'lastName')
});
var john = App.Person.create({
firstName: "John",
lastName: "Doe"
});
john.get("fullName"); // John Doe
Computed Property
http://jsfiddle.net/cBWsr/2/
femalesCount: function() {
var people = this.get('people');
return people.filterProperty( 'isFemale', true).
get('length');
}.property('
[email protected]' )
What about computed property for arrays, hãn?
Ember.Object