Having trouble reading the precompiled templates in my HTML due to compatibility issues between ember-precompile, ember.js, and handlebars.js.
My code looks like this:
Includes the following files.
<script src="../js/libs/jquery-1.10.2.js"></script>
<script src="../js/libs/handlebars-v1.3.0.js"></script>
<script src="../js/libs/ember-1.2.0.js"></script>
<script src="js/precompile.js"></script>
<script src="js/precompile.app.js"></script>
Attempting to read my compiled template inside the body tag.
<div id="tempdiv">hello</div>
<script type="text/javascript">
var compiledTemplate = Em.TEMPLATES["precompile"];
var temp_html = compiledTemplate({ name: 'World' });
console.log(temp_html); //Uncaught TypeError: Cannot read property 'push' of undefined
$("#tempdiv").html(temp_html);
</script>
Already installed npm handlebars compiler version in command prompt as:
npm install <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8be3eae5efe7eee9eaf9f8cbbaa5b8a5bb">[email protected]</a> -g
Handlebars COMPILER_REVISION in console shows as 4
Handlebars.COMPILER_REVISION -- 4
With these versions, I can read the templates using Handlebars as
Handlebars.templates['test_temp'];
Then installed ember-precompile from the following package -
Installed in command prompt as:
npm install ember-precompile
Now struggling to read the compiled templates using Em.TEMPLATE["template_name"].
There seems to be a compatibility issue with the versions of ember, handlebars, and ember-precompile I have included and installed.
Which version of each one matches and can successfully read the compiled templates?