テンプレートをプリロードするために、アプリケーションで次のコードを使用しました。jQueryを使用してテンプレートをファイルに追加してから、アプリケーションを起動します。コードは微調整を使用することができますが、それは私のために働いています...
var loaderObj = {
templates : [
'_personMenu.html',
'application.html',
'index.html',
'people.html',
'person.html',
'people/index.html',
'friend.html'
]
};
loadTemplates(loaderObj.templates);
//This function loads all templates into the view
function loadTemplates(templates) {
$(templates).each(function() {
var tempObj = $('<script>');
tempObj.attr('type', 'text/x-handlebars');
var dataTemplateName = this.substring(0, this.indexOf('.'));
tempObj.attr('data-template-name', dataTemplateName);
$.ajax({
async: false,
type: 'GET',
url: 'js/views/' + this,
success: function(resp) {
tempObj.html(resp);
$('body').append(tempObj);
}
});
});
}
var App = Ember.Application.create();
//Rest of the code here...