I am using underscore.js's templating library, and I am not sure how to go about using a logic inside of a template. for example, I would like to print an array of tags in a template. What is the best approach for this?
Javascript:
bunny_data = {
name: "sprinkles",
age: 1,
tags: ['fuzzy','wuzzy']
};
bunny_view = $("#bunny-template").html();
$(body).append(_.template(bunny_view,bunny_data));
Template:
<script type='text/template'>
<div>
<h5><% = name %></h5>
<ul class='tag-list'>
<!-- How do I print the tags here? -->
</ul>
</div>
</script>