emberjs模板编译在rc1中不起作用 [英] emberjs template compile doesn't work in rc1
问题描述
我有
Esploreo.TE.Views.ItemView = Ember.View.extend({
elementId : "item",
templateName : 'itemTemplate'
});
和类似模板的
<script type="text/x-handlebars" data-template-name="itemTemplate">
content of templat
</script>
一切正常。但是我不想使用这种编码。在以前的Ember版本中,可以在视图的定义中编写模板代码,如下所示:
and all works good. But i don't to want to use this type of coding. In previous Ember versions it was possible to write the template code in the definition of view, like this:
Esploreo.TE.Views.ItemView = Ember.View.extend({
elementId : "item",
template: Em.Handlebars.compile('content of template'),
});
,但是它不起作用(emberjs 1.0.0-RC.1)。此功能已从此版本中删除吗?
but it doesn't work (emberjs 1.0.0-RC.1). This features is removed from this release?
推荐答案
这是使用Ember的一种奇怪方法!不过,要回答您的问题,您需要在 .create()
的末尾添加 .append()
因此:
That's a curious way of working with Ember! To answer your question though, you need to add .append()
to the end of your .create()
like so:
App.ItemView.create()。append();
必需的jsFiddle: http://jsfiddle.net/MGXDe/
Obligatory jsFiddle: http://jsfiddle.net/MGXDe/
虽然我不知道您的用例,但我还是不能过分强调,这似乎太好奇了,以至于Ember使用不当
Whilst I don't know your use case for this, I can't stress enough that this seems a little too curious, bordering on bad usage of Ember.
这篇关于emberjs模板编译在rc1中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!