How to reexecute onCreated template when redirect to an other element in same template meteor
Can you describe in a bit more detail what you’re doing, what the desired behaviour is and what the current behaviour is?
If it’s just new data being passed into the same template, you can trigger re-running part of the initialization logic with an autorun
like so:
Template.example.onCreated(function() {
this.autorun(() => {
const data = Template.currentData(); // This is a reactive source, so new data passed from the parent will cause a re-render.
doSomethingWithData(data);
});
});
2 Likes
it works now thanks a lot
1 Like