Skip to content

Instantly share code, notes, and snippets.

@AdamBrodzinski
Created November 24, 2012 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBrodzinski/4137894 to your computer and use it in GitHub Desktop.
Save AdamBrodzinski/4137894 to your computer and use it in GitHub Desktop.
Backbone Template Helpers
// precompiled backbone underscore template helper
var getTemplate = function (id) {
return _.template( $('#'+ id).html() );
};
// doesn't call underscore
var uncompiledTemplate = function (id) {
return $('#'+ id).html();
};
var myView = Backbone.View.extend({
template : getTemplate('myTemplateID')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment