Supriya Kale
Supriya Kale

Reputation: 845

Uncaught TypeError: undefined is not a function in compiled-templates.js

I was working on first application in ember where the versions of handle bars and ember.js were quite old.

I am using bower to install all dependencies. But once I got error in console while running the application, I specified the version of ember.js to 1.8 and that of handlebar to 2.0.0 in bower.json file. But now as the templates were little old I started getting error like 'Unknown template object: function while using handlebars 2.0'. To resolve this error I used steps mentioned here .

But still I get a new error saying Uncaught TypeError: undefined is not a function. Can anyone please suggest how to upgrade the templates now? Or there is some other way round.

Upvotes: 1

Views: 1032

Answers (3)

kushdilip
kushdilip

Reputation: 7906

In production version handlebars.runtime.js is being used instead of handlebars.js. The runtime version doesn't have Handlebars.compile method. If you are using ember-cli then you can replace new EmberApp(); with

new EmberApp({
   vendorFiles: {
     'handlebars.js': {
       production: 'bower_components/handlebars/handlebars.js'
     }
   }
 });

for reference: http://www.ember-cli.com/#customizing-a-built-in-asset

Upvotes: 0

Supriya Kale
Supriya Kale

Reputation: 845

I had to update a few dependencies mentioned in package.json. - ember-template-compiler of node. The solution mentioned on this link was useful for me.

Thanks

Upvotes: 0

Kingpin2k
Kingpin2k

Reputation: 47367

Handlebars 2.0 wasn't supported until Ember 1.9.

Upvotes: 0

Related Questions