Meteor: Tracker.autorun when updating Iron-Router data
I am using the iron-router function data
to provide data to my HTML template.
snippet from router.js:
data: function() {
liveData = {
dataA: Collection.findOne({queryA}),
dataB: Collection.findOne({queryB})
};
return liveData;
}
Within my template, the object liveData
is reactive. When the collection changes, changes to liveData are great!
But my question is: I have a javascript function called computation()
inside Template.name.rendered
that uses an object liveData
. It runs once on page load - great - but after page load liveData
changes, but the computation is not re-executed. How to force computation()
restart when the data source of the router hardware liveData
changes?
source to share