Iron-Router does not render template a second time to modify data in the same route

I have a route using an iron router as described below:

//// Preview ROUTE
Router.route('/preview/:_id', {
  template:'preview',
  subscriptions: function() {
      return Meteor.subscribe('files', 'preview', currentIncident());
},
data: function () {
    return Files.findOne(this.params._id);
},
action: function () {
    if (this.ready()) {
        this.render();
    } else {
        this.render("loading");
    }
},
onAfterAction: function() {
    // always start by resetting scroll to top of the page
    $(window).scrollTop(0);

}

      

});

Template.preview.rendered

only called when I come from a different route, i.e. /home

... However, if I use Router.go("/preview/someID")

from a /preview/differentID

, the call is Template.preview.rendered

not called. Is there a way to get around this problem?

+3


source to share





All Articles