Does sammy.template has a foreach loop?

Skip to first unread message

tarcisio tarcisio

Jun 21, 2017, 2:59:53 PM6/21/17
to Sammy.js
I'm using Sammy.Template to render my views; therefore, I need to be able to enter inside an object array returned by my function using a foreach.
Is it possible?

For example:

<%= result.steps[0].step1.fields %>
<%= result.steps[0].step2.fields %>
<%= result.steps[0].step3.fields %>

Each of the fields are an array of objects that I need to go through.

Thank you,

Tarcisio Lima

Ronald Sterckx

Jun 21, 2019, 10:38:39 AM6/21/19
to Sammy.js
Yes, to make a table for list of fields. I'm not sure about the structure of your object, so I can have errors in here
<% result.steps.forEach(function(step) { %>
<td><%= step.field %></td>
<% }); %>

Op woensdag 21 juni 2017 20:59:53 UTC+2 schreef tarcisio tarcisio:
Reply all
Reply to author
0 new messages