Trying to convert very complex jQuery template code to jsRender. I have this each loop in the old code:
<script id = "imagesTemplate" type="text/x-jquery-tmpl">
{{each(i,imgUrl) twoAcross_filterOutMainImages(OfferGroup.Images)}}
<img src="{{= imgUrl}}" />
{{/each}}
</script>
<script id = "largeTemplate" type="text/x-jquery-tmpl">
{{tmpl "#imagesTemplate"}}
</script>
<div id="LARGE" class="mainContent"></div>
<script>
currentOffer = offerGroups[0].Groups[0];
$( "#LARGE" ).html( $( "#largeTemplate" ).render( currentOffer ) );
</script>
I have edited it to look like this:
{{for ~filterOutMainImages(Images) tmpl="#imagesTemplate"/}}
<div id="LARGE" class="mainContent"></div>
<script>
currentOffer = offerGroups[0].Groups[0];
$( "#LARGE" ).html( $( "#largeTemplate" ).render( currentOffer ) );
</script>
But it does not work. If I change it to be:
<script id = "imagesTemplate" type="text/x-jquery-tmpl">
<img src="{{= imgUrl}}" />
</script>
<script id = "largeTemplate" type="text/x-jquery-tmpl">
{{for Images tmpl="#imagesTemplate"/}}
</script>
<div id="LARGE" class="mainContent"></div>
<script>
currentOffer = offerGroups[0].Groups[0];
$( "#LARGE" ).html( $( "#largeTemplate" ).render( currentOffer ) );
</script>
It draws the images to display but the function does not run on the image array. But if I leave the Images array without being wrapped in a function and move the for loop to inside the template it breaks.
How would I convert this scenario?