Reputation: 61
Param:
'<div class="someclass">' + somecontent + '</div>' + somecontent2
Template:
<div>{{ param }}</div>
And in browser I have:
<div class="someclass"> somecontent </div>somecontent2
How to isolate .someclass
, that it render as a dom element, not text?
Upvotes: 6
Views: 927
Reputation: 1401
I would suggest using partial templates for this.
<script id="main" type="text/html">
<div>{{>partial}}</div>
</script>
<script id="partial" class="partial" type="text/html">
<div class="someclass">{{somecontent}}</div>{{somecontent2}}
</script>
Then just call the main template with your data as normal:
html = ich.main({
somecontent: 'content',
somecontent2: 'content2'
});
Upvotes: 0
Reputation: 854
I think all Html elements are escaped by default. To return un-escaped Html use the triple mustache:
<div>{{{param}}}</div>
Upvotes: 9