Reputation: 1067
I've been trying to make bindings work in Ember with a really simple example but they don't work properly. It shouldn't be a matter of synchronization since I'm calling Ember.run.sync(). The code that I'm using is the following:
var MyApp = Ember.Application.create();
MyApp.initialize();
MyApp.president = Ember.Object.create({
name: "Barack Obama"
});
MyApp.country = Ember.Object.create({
// Ending a property with 'Binding' tells Ember to
// // create a binding to the presidentName property.
presidentNameBinding: 'MyApp.president.name'
});
// Later, after Ember has resolved bindings...
Em.run.sync();
console.log(MyApp.country.get('presidentName'));
And I've also created a fiddle here.
Upvotes: 1
Views: 401
Reputation: 701
You should declare MyApp without "var", the first line should be:
MyApp = Ember.Application.create();
See more details here: http://docs.emberjs.com/#doc=Ember.Application&src=false
Upvotes: 3