var Demo = Ember.Application.create(); Demo.president = Ember.Object.create({ name: "Barack Obama" }); Demo.country = Ember.Object.create({ // Ending a property with 'Binding' tells Ember.js to // create a binding to the presidentName property. presidentNameBinding: 'Bindings.president.name' }); Demo.country.get('presidentName'); // "Barack Obama"
var Demo = Ember.Application.create({ rootElement: '#computed-properties' }); Demo.president = Ember.Object.create({ firstName: 'Barack', lastName: 'Obama', fullName: function() { return [this.get('firstName'), this.get('lastName')].join(' '); }.property('firstName', 'lastName') });
<script type="text/x-handlebars"> The President of the United States is {{Demo.president.fullName}}. </script>