未捕获错误:在未加载模板编译器的情况下,无法调用“compile”.请在调用“compile”之前加载“ember te

Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`

本文关键字:compile 调用 加载 ember te 情况下 错误 编译器      更新时间:2023-09-26

im是ember.js框架的新成员,使用ruby on rails和ember.debug.js-v1.10.1(最新版本)。我一直在网上读到ember更改了这个最新的补丁,但我不知道如何解决我的问题:

Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.

有人能帮我推动编译器正常运行吗?我希望我知道我的项目中的哪些代码片段将有助于确定答案。。。

这篇文章可能会帮助你:

http://emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.html

如果你不使用ember-cli,你的HTML应该是这样的:

<script src="assets/ember-template-compiler.js"></script>
<script src="assets/ember.debug.js"></script>

如果您使用的是ember-cli,那么您的模板应该是预编译的,您不应该有这个问题。

我们需要在应用程序中包含ember-template-compiler.js。我认为ember rails默认情况下不包括这一点。

将其添加到您的app/assets/javascripts/application.js 中

//= require ember-template-compiler