Home
Run
Demo: Using ${} or {{html}} to render data values or expressions
- ${} is equivalent to {{= }}. It HTML encodes. (Better security, but slight perf cost)
- {{html}} does not encode. Used to render values that include html markup
Data:
var movies = [
{
Title: "Eyes Wide Shut",
Synopsis: "Director <span class='red'>Stanley Kubrick's</span> final film:<img src='...'/>"
}
];
HTML:
<script id="movieTemplate" type="text/x-jquery-tmpl">
<tr>
<td>${Title}</td>
<td class="synopsis">{{html Synopsis}}</td>
</tr>
</script>