Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created March 3, 2011 14:37
Show Gist options
  • Save topherfangio/852855 to your computer and use it in GitHub Desktop.
Save topherfangio/852855 to your computer and use it in GitHub Desktop.
TemplateView with Handlebars
<h1>Test Handlebars Page</h1>
<p>
I really like {{ somevar }}!
</p>
MyApp.TestView = SC.ScrollView.extend({
render: function(context) {
// Note: Do not use the word 'view' as a key in the following data object,
// as SproutCore and/or Handlebars will not display it properly
// (probably because it's a helper function)
var data = { somevar:"SproutCore" };
var template = SC.TEMPLATES['test'](data);
context.push( template );
},
update: function(jquery) {
// do whatever you need to for somevar...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment