在我们的应用程序中,我们通过使用工具栏模板调用Ember.HTMLBars.compile来在运行时使用模板编译器。示例代码:
let myTemplate = `{{foo}}`;
application.register(`template:my-template`, Ember.HTMLBars.compile(myTemplate));我试图从Ember 2.6升级到Ember 2.7,但是如果我试图编译模板,开发人员控制台中会出现以下错误:
_ember.default.HTMLBars.compile不是一个函数()
在文档中,我找不到从HTMLBars编译器中删除编译方法的任何信息。
如何在我的应用程序中仍然在运行时使用/启用HTMLBars编译器?
发布于 2016-11-11 02:19:14
在ember-template-compiler.js中导入原始ember-cli-build.js
app.import('bower_components/ember/ember-template-compiler.js');发布于 2016-12-08 14:18:38
我需要在运行时编译模板,并使用https://www.npmjs.com/package/ember-cli-handlebars-inline-precompile。试试这个:
import hbs from 'htmlbars-inline-precompile';
application.register(`template:my-template`, hbs`{{foo}}`);发布于 2016-09-15 08:08:49
由于提供的信息较少,所以首先尝试检查错误源.
大概是一个库,您需要打开您的开发人员控制台,让我们说,铬,然后单击错误,这将引导您的错误来源,以便您可以调整或纠正代码.
https://stackoverflow.com/questions/39505807
复制相似问题