Skip to content

Instantly share code, notes, and snippets.

@apike
Created February 15, 2011 22:11
Show Gist options
  • Save apike/828376 to your computer and use it in GitHub Desktop.
Save apike/828376 to your computer and use it in GitHub Desktop.
MyApp = SC.Object.create();
MyApp.userController = SC.Object.create({
name: null
});
MyApp.manualView = SC.View.create({
name: SC.Binding.from('MyApp.userController.name')
});
MyApp.magicView = SC.View.create({
nameBinding: "MyApp.userController.name"
});
MyApp.userController.set('name', 'Joe');
SC.RunLoop.begin();
SC.RunLoop.end();
console.log(MyApp.magicView.get('name')); // Prints 'Joe'
console.log(MyApp.manualView.get('name')); // Prints an SC.Mixin object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment