I cannot read the precompiled templates in my html. It is due to the version compatible issue of ember-precompile with ember.js and handlebars.js.
My code goes like this:
Included the below 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>
Reading my compiled template inside body tag.
<div id="tempdiv">haii</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>
I have already downloaded npm handlebars compiler version in command prompt as:
npm install [email protected] -g
In console the handlebars COMPILER_REVISION is coming as 4
Handlebars.COMPILER_REVISION -- 4
With the above versions i can read the templates using Handlebars as
Handlebars.templates['test_temp'];
Then i installed ember-precompile from the below package -
Installed in command prompt as:
npm install ember-precompile
Now I am not able to read the compiled templates using Em.TEMPLATE["template_name"].
There is compatible issue with the versions of ember, handlebars and ember-precompile I have included and installed.
What version of each one matches and can read the compiled templates.