symfony - handlebars template can't fill with data -
i need output data , fill template throught custum function
this imports
<script src="{{ asset('bundles/.../handlebars/handlebars.js') }}"></script> <script src="{{ asset('bundles/.../handlebars_helpers.js') }}"></script>
this template twig page
<script id="di_template" type="text/x-handlebars-template"> {% verbatim %} <h1>title </h1> invoice {{ invoice.invoice_number }} {% endverbatim %} </script>
this build template function
function buildtemplate(){ context = { invoice: { invoice_number: 'val1', invoice_date: 'val2', invoice_due_date: 'val3', invoice_from_company: 'val4' } }; template = $('#di_template').html(); template_compiled = handlebars.compile(template); thecompiledhtml = template_compiled(context); $invoice_preview.html(thecompiledhtml); }
Comments
Post a Comment