我正在将一个json对象输入到underscore.js模板中。我想在顶部说:“这是总记录中的n条”。有人知道该怎么做吗?在下面的示例中,我如何得到totalNum
?
underscore.js:
<script type="text/template" id='templatePropertyLot'>
<% _.each(items,function(item,key,list) { %>
<div class="popup_wrapper">
<div class="header" id="count_of_addresses"><span id="currNum"><%- key + 1 %></span> of <span id="totalNum"></span> addresses in this search</div>
</div>
<% }); %>
</script>