Hello everyone. I’m learning MeteorJS few days now and its really awesome.
I would like to know how can I make that every 5 jokes it gives me an advertisment lets say something like that?
I’m still learning and I’m don’t know how to work with @index variable…
Could You explain me how my isTimeforAd should look in JS?
And how to use it like that?
Thank You alot
In your {{ #each }}, just set @index as the argument of your helper.
Then your helper function will receive one argument, the index (which is a number). Test this index with a modulo 5 and return true / false (like in your previous post).
To clarify what was mentioned by @borntodev. It is usually a better pattern to avoid making the same query multiple times in your template, so you can just pass @index (which is the current index in the #each iteration) to the template helper: