blueimp/JavaScript-Templates

0 (number) is not rendered

Closed this issue · 1 comments

Example:

var template = tmpl('#template', {n: 0});
$(body).append(template);

<body>
<script id="template" type="text/x-templ">
<p>N = {%=o.n%}</p>
</script>
</body>

Result will be:
<p>N = </p>

But when the data is {n: '0'} that's OK
<p>N = 0</p>

Are you using the latest version?
0 renders as expected in my tests on the demo and there's also a unit test for exactly this feature:

Print out escaped falsy values except undefined or null

http://blueimp.github.io/JavaScript-Templates/test/