Javascript Template not created correctly

96 Views Asked by At

I am using HTML templates embedded in a <script> using Javascript Templates to render them.

Using a sample provided, the template is transmitted to the browser appropriately;

enter image description here

However, when collected by its ID, it does not look anything close to what it should;

enter image description here

What could be causing this; encoding or escaping? Something else entirely?

**UPDATE**

As a quick workaround proposal, I tried moving my templates from an MVC partial, to webpack. Without going into too much detail, it seems as if using html-loader and manually bootstrapping the templates to a div worked a charm. Maybe MVC is screwing with something?

$('div.upload-templates').append(require('html-loader!./legacy/upload-templates.html'))

Still curious as to what really is going on...

1

There are 1 best solutions below

0
On
<script type="text/x-tmpl" id="tmpl-demo">
  <h3>{%=o.title%}</h3>
</script>

use this format. for example "https://github.com/blueimp/JavaScript-Templates"