Js code
exampleArray = [project1,project2];
var templateproject = JIRA.Templates.LP.project(exampleArray);
AJS.$('#page-container').append(templateproject);
soy template
{namespace JIRA.Templates.LP}
{template .project}
<table class="aui">
<thead>
<th>Project Title</th>
</thead>
<tbody>
{foreach $key in keys($exampleArray)}
<tr>
<td>{$exampleArray[$key]}</td>
</tr>
{/foreach}
</tbody>
</table>
{/template}
Is this correct way of looping soy template when passing array as data.
You can also do:
{foreach $project in $exampleArray} <tr> <td>{$project}</td> </tr> {/foreach}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.