Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created August 26, 2011 15:30
Show Gist options
  • Save topherfangio/1173669 to your computer and use it in GitHub Desktop.
Save topherfangio/1173669 to your computer and use it in GitHub Desktop.
Handlebars Text Binding
var App = SC.Application.create();
App.myVar = 'test';
App.BasicTextView = SC.View.extend({
textValue: null,
textValueDidChange: function() {
var jQuery = this.$();
var textValue = this.get('textValue');
jQuery.text(textValue);
}.observes('textValue'),
render: function(context) {
context.push(this.get('textValue'));
}
});
...
<script type="text/x-handlebars">
{{view App.BasicTextView textValueBinding="App.myVar" tagName="h1"}}
</script>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment