How can accomplish an if else statement from the underscore template to mustache
- by user2942566
I have an underscore template and I have to use Mustache to render it. Below is my underscore template:
<div id="sub-account">
<p>something</p>
<table>
<tr><td>Name</td>
</tr>
<tbody>
<% _.each(accountList, function(account) { %>
<tr>
<td><%= account.get('name') %></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
Im using a mustache as my main view to render a list. I also added
_.templateSettings = {
evaluate : /\{\[([\s\S]+?)\]\}/g,
interpolate : /\{\{([\s\S]+?)\}\}/g,
escape : /<%-([\s\S]+?)%>/g,
};
to my undersocre.js settings. How can i loop through the code to render as a mustache template. Any ideas???