Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
dynamic template loading
* Loads a handlebars.js template at a given URL. Takes an optional name, in which case,
* the template is added and is reference-able via templateName.
function loadTemplate(url, name, callback) {
var contents = $.get(url, function(templateText) {
var compiledTemplate = Ember.Handlebars.compile(templateText);
if (name) {
Ember.TEMPLATES[name] = compiledTemplate
} else {
Ember.View.create({ template: compiledTemplate }).append();
if (callback) {
Copy link

teabyii commented Apr 4, 2014

Very good! I take it!

however, there is a little problem:
in 9 lines, miss ; in the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment