I have been getting this error after upgrading my ember :
template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?
My configuration is:
ember 1.10.0
ember-data 1.0.0-beta.14.1
jquery 1.9.1
Upon searching for this issue, it seems like I have to enable feature
EmberENV: {
FEATURES: {
'ember-htmlbars': true
}
},
but we are not using ember cli at this moment. I read up on http://emberjs.com/guides/configuring-ember/feature-flags/ and then tried this :
var EmberENV = {FEATURES: {'ember-htmlbars': true}};
//var EmberENV = {ENABLE_ALL_FEATURES: true}; //tried this too
//Ember.FEATURES["ember-htmlbars"] = true; //tried this too
window.AS = Ember.Application.create({
..
});
but this still didn't help. So what is the correct way to enable feature?
Thanks, Dee
UPDATE :
We were compiling our hbs files via grunt and we just needed to update these in package.json :
"devDependencies": {
"grunt-ember-templates": "~0.5.0",
"ember-template-compiler": "~1.9.0-alpha",
....
}
And in my gruntfile.js had to make following change in my emberTemaple :
emberTemplates: {
options: {
templateCompilerPath: 'lib/ember/ember-template-compiler.js',
handlebarsPath: 'lib/handlebars/handlebars.js',
templateNamespace: 'HTMLBars',
templateName: function (sourceFile) {
...
}
},
Robert Jackson wrote on these changes but I don't seem to find the address to the post! That way I got my templates to be compiled to proper htmlbars format.
var
and just declaringEmberENV = {ENABLE_ALL_FEATURES: true}
. Depending upon which version of ember you are using you can also tryENV = {ENABLE_ALL_FEATURES: true}
without the Ember prefix. – Oren Hizkiya