I have the following template for a modal
<div class="ui-modal">
<div class="mask"></div>
<div class="ui-modal-container">
<div class="ui-modal-header">
<h3><%= modal['title'] %></h3>
</div>
<div class="ui-modal-text">
<p><%= modal['description'] %></p>
</div>
<% if ( modal['buttons'] !== 'undefined' ) { %>
<div class="ui-button-container">
<a class="ui-button ui-button-pill <%= modal['buttons'][0]['extra_class'] %> " href="<%= modal['buttons'][0]['href'] %>">
<span class="label">
<span class="section"><%= modal['buttons'][0]['label'] %></span>
</span>
</a>
</div>
<% } %>
</div>
</div>
and this is the data I am trying to populate it with:
_data = {
"modal" : {
"title" : "Your address is:",
"description" : "Some desc here",
"buttons" : [
{'extra_class': 'small left', 'href' : '#register/3', 'label' : 'Back'},
{'extra_class': 'small center', 'href' : '#register/4', 'label' : 'Next'},
{'extra_class': 'small right', 'href' : '#', 'label' : 'Reset'}
]
}
}
What I want to achieve is an iteretaion where I had "hardcoded" the index (0) in <%= modal['buttons'][0]['extra_class'] %>. I presume this is an easy question, but unfortunately I could find anything that I could apply in my case.
Any help will be greatly appreciated!
Thank you!