Skip to content

Instantly share code, notes, and snippets.

@samdelagarza
Created February 9, 2012 21:01
Show Gist options
  • Select an option

  • Save samdelagarza/1783056 to your computer and use it in GitHub Desktop.

Select an option

Save samdelagarza/1783056 to your computer and use it in GitHub Desktop.
Backbone.View.extend({
template: 'my-view-template',
render: function () {
var deferred = new $.Deferred(),
promise = deferred.promise(),
that = this;
require('/templates/' + this.template + '.html', function (tmpl) {
deferred.resolve(that.$el.html(tmpl));
});
return promise;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment