I just started to study Ember.js and read the eyepiece at http://emberjs.com/ . In the "Binding" section, I simply copied and pasted the following code and executed it in a Chrome browser. Related data (App.husband.get ('homeIncome')) always returned 'undefined'. You know why? I would like to know why my code is not working.
----- HTML Code ------
<html>
<body>
<script src="js/libs/jquery-1.7.2.js"></script>
<script src="js/libs/ember-0.9.6.js"></script>
<script src="js/app.js"></script>
</body>
</html>
----- app.js ------
var App = Ember.Application.create();
App.wife = Ember.Object.create({
householdIncome: 80000
});
App.husband = Ember.Object.create({
householdIncomeBinding: 'App.wife.householdIncome'
});
console.log(App.wife.get('householdIncome'));
console.log(App.husband.get('householdIncome'));
------ Result Result -----------
80000
undefined
source
share