Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I listen to when a template is rendered in Meteor?

Tags:

meteor

I have some post-processing that I have to do on a list of HTML elements whenever they are updated from the backend. Is there some event (like, onRender) that I can listen to on the template to facilitate this?

like image 356
Mattias Petter Johansson Avatar asked Apr 21 '12 14:04

Mattias Petter Johansson


Video Answer


1 Answers

For Meteor starting from 0.4.0 preview, you can use Template.myTemplate.rendered for this.

Template.myTemplate.rendered = function() {
      console.log('Template has been (re-)rendered');
}
like image 185
Joscha Avatar answered Oct 07 '22 21:10

Joscha