danass
1
How to apply or queue a jQuery transformation on one object at a time, right after they have been queried by #each iteration.
Example:
{{#each post in posts}}
<div class="post">
{{post.fields.text}}
</div>.
<!-- queue/apply jquery on this instance of $('.post') -->
{{/each}}
Put the post in a sub-template and then call the jQuery in the onRendered
<template name=posts>
{{#each post in posts}}
{{>post_template post=post}}
{{/each}}
</template>
<template name=post_template>
<div class="post">
{{post.fields.text}}
</div>
</template>
Template.post_template.onRendered(function(){
const instance = this
instance.$('.post')....
})
3 Likes
danass
3
Oh yes.
You just opened a new range of possibilites to me.
Thank YOU.