Node.js: I am iterating through the contents of title2 using for loop. But to make the div tag unique, I am using the {{var i=0;}}
it gives the following error expected variable end
. I also tried {% var i = 0; %}
but that too doesnt seem to work I have put the end tag but it does not seem to work. I might mostly be putting the wrong end tag but I cannot figure out the right one. Can I know if this is the right way to declare a variable and end it? Also if this is the right way to increment the variable in the HTML file?
{% extends "base.html" %}
{% block content %}
<div><h4>Python Examples</h4>
{% for contentPackage in contentPackages %}
{% for ex in contentPackage.title2 %}
{{var i=0;}}
<div class="contentPackage col-md-4">
<h5 style="font-size: 15px;padding-left: 3px" class="packageTitle bg-primary">{{ ex['topic_name'] }}
<a href="javascript:void(0)" class="easyui-link" onclick="javascript:$('#pane'+i).panel('open')"> [Open</a>
<a href="javascript:void(0)" class="easyui-link" onclick="javascript:$('#pane'+i).panel('close')">Close] </a>
</h5>
<div id="pane{{i}}" closed="true" openAnimation="slide" closeAnimation="slide" class="easyui-panel" title="{{ ex['topic_name'] }}" style="padding:2px;">
<div class="contentPackageMain">
<div class="teaserContent">
<ol>
<p>Something</p>
</ol>
</div>
</div>
</div>
</div>
{{i++}}
{{endvar}}
{% endfor %}
{% endfor %}
</div>
{% endblock %}