Your problem is that you are using the wrong type tag for the Underscore.js template, the tag you are using is designed to interpolate the value and its HTML escape.
To explain, there are three types of tags in underscore templates,
<%= %> - Interpolate - evaluates these properties and prints it.<%- %> Escape . Calculates data and displays it using HTML.<% %> Rate . Allows you to execute javascript in your template.
In addition, when running JavaScript inside your template, you can use the Print method to print some text (for example, attribute results).
Based on the foregoing, in your case, you need to run the conditional expression in your template in order to print the checked expression, if it is executed, to true. So you can do the following:
<% if(done) { %> 'checked="checked" <% } %>
Or you can use the Print method
<% print(done ? 'checked="checked"' : '') %>
Edit:
Based on the template you posted, the following template should work
<script id="item-template" type="text/template"> <input type="checkbox" id="toggle" <% print( done ? 'checked="checked"' : '') %> /> <span class="text">{{-done}}</span> <a id="dele" data-role="button" data-inline="true" data-icon='delete' >Delete</a> </script>
Here is a link to jsBin using ERB style default delimiters
And here's the second one using mustache style dividers.
source share