Ember.js: HtmlBars and the Handlebars.compile command

后端 未结 3 1800
生来不讨喜
生来不讨喜 2020-12-16 21:58

I get the following error when running my app:

Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compil         


        
3条回答
  •  醉酒成梦
    2020-12-16 22:38

    You are trying to compile HTMLBars template on the client, however adding ember-template-compiler in package.json only enables precompilation of HTMLBars templates server-side.

    To enable client-side compilation, you should add ember-template-compiler to the bower.json, e.g. (use appropriate version)

    "ember-template-compiler": "http://builds.emberjs.com/tags/v1.10.0-beta.3/ember-template-compiler.js"
    

    and then include it in Brocfile.js,

    app.import('bower_components/ember-template-compiler/index.js');
    

提交回复
热议问题