【发布时间】:2013-03-28 07:00:37
【问题描述】:
按照 Ember 模板指南,我执行以下操作:
App.PostsView = Ember.View.extend({
template: Ember.Handlebars.compile('I am the template')
});
但是没有渲染任何东西。当我使用 templateName 时,视图 呈现:
// html
<script type='text/x-handlebars' data-template-name='posts-template'>
<h1>I am the template</h1>
</script>
// js
App.PostsView = Ember.View.extend({
templateName: 'posts-template'
});
如何使用指南中所述的template 函数使模板正常工作?
编辑:
我确实遇到过这些:
emberjs template compile doesn't work in rc1
How do I specify using a view with a compiled handlebar in ember.js RC1
所以这个可能看起来像复制品。然而,这首先似乎使用了一些未在 Ember 指南中指定的额外工作,第二个是我正在做的,但它不起作用。
【问题讨论】:
标签: ember.js