Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how do i loop Soy templates with data as array passed to template

GopiR June 13, 2016

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.

 

 

 

1 answer

2 votes
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 13, 2016

You can also do:

{foreach $project in $exampleArray}
&lt;tr&gt;
&lt;td&gt;{$project}&lt;/td&gt;
&lt;/tr&gt;
{/foreach}

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, aafp, jira migration, marketing collaboration, end siloed work, streamline workflows, kerrie gottschalk, jira cloud admins, unified marketing, process visibility, team efficiency, cross-team collaboration

How Kerrie Gottschalk unified AAFP’s marketing team with Jira

At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.

Read the story
AUG Leaders

Atlassian Community Events