Skip to content

Instantly share code, notes, and snippets.

@jiripospisil
Created June 7, 2013 08:57
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 jiripospisil/5727982 to your computer and use it in GitHub Desktop.
Save jiripospisil/5727982 to your computer and use it in GitHub Desktop.
Ember.js: Resolve templates using ajax
App = Ember.Application.create({
resolver: Ember.DefaultResolver.extend({
resolveTemplate: function (parsedName) {
var template = this._super(parsedName);
if (!template) {
var templateName = parsedName.fullNameWithoutType.replace(/\./g, "/"),
filePath = "/assets/templates/" + templateName + ".js";
$.ajax({
url: filePath,
async: false,
dataType: "script"
});
template = this._super(parsedName);
}
return template;
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment