using Meteor JS, I would like to start a basic jQuery function (which will resize some elements) every time a template is loaded. I tried to call this function inside Meteor.startup() but this doesn't work. I also tried to launch my function on Router.onBeforeAction() with no more results (I'm using ironRouter).
Is there any way to do something like:
Template.someTemplate.created = function(){
myUpdateFunction();
};
But instead of loading this on a specific template, I would like to automatically load this on every templates in my app.
Is there a way to simply achieve this?
Thanks.
This will log every Template's name after it is created:
Template.prototype.created = function() {
console.log(this.view.name);
}
However your jquery will require the template to be rendered, so this will probably work better:
Template.prototype.rendered = function() {
console.log(this.view.name);
}