我想即时加载其他模板。可能吗?
最佳答案
您可以在Ember.TEMPLATES
中注册新模板。然后将它们提供给 View 。
我的代码摘录(jQuery Ajax处理程序):
success: function(data) {
$(data).filter('script[type="text/x-handlebars"]').each(function() {
templateName = $(this).attr('data-template-name');
Ember.TEMPLATES[templateName] = Ember.Handlebars.compile($(this).html());
});
}
而已。
关于ember.js - 是否可以通过Ajax加载Handlebars模板?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9469235/