Underline pattern: for dynamic operator values
I am using the underscore pattern to retrieve and display values โโfrom a model. This below code works fine.
<% for (var i = 1; i <= data.total; i++) { %>
<td>List <%= i %> </td>
<% } %>
for the same i need to get dynamic values โโthat are stored in a model like {List1, List2, List3, etc.} and must display it in the template.
for what i tried
1. <% for (var i = 1; i <= data.total; i++) { %>
<td><%- data.List<%= i %> %></td>
<% } %>
2. <% for (var i = 1; i <= data.total; i++) { %>
<td><%- data.List${i} %></td>
<% } %>
where data is model objects and List1, List2..name of its values.
Both of the above codes don't work. I just checked out a freemaker template that supports this operation.
Is it possible to get the same type or any other approach to achieve this?
+3
source to share