javascript - populate handlebars.js template with an array of strings from js -


i have no clue if possible, have spent lot of time trying figure out how it. have array of string values in .js file include html tags. array similar this:

var values = [     <h1>introduction</h1>,     <h3>words</h3>,     <p>more words</p> ] 

i attempting have them inserted handlebars template, can't seem find way it. have tried using variation of {{ #each _ }} method node.js no avail. please let me know how this, or if it's possible.


here's current code. trying array of data display when it's hard-coded in html. getting no errors, code not display. esoms tutorial

<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.js"></script> <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript" src="c://node.js/server.js"></script> </head> <body>    <script id="content-template" type="text/x-handlebars-template">     {{#each data}}           {{this}}     {{/each}}   </script>    <script type="text/javascript">     $(document).ready(function() {        var data = [             '<h1>introduction</h1>',             '<h3>the enterprise shift operations management system</h3>',             '<p>the enterprise shift operations...</p>',             '<p>the purpose of tutorial to...</p>'         ];        if(!handlebars.templates){ handlebars.templates = {}; }        handlebars.templates.full = handlebars.compile($("#content-template").html());         $('#output').html(handlebars.templates.full({data: data}));     });   </script>    <div id='output'></div> </body> </html> 

there's more code think i've got relevant.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -