yiyizheliu
yiyizheliu

Reputation: 33

How can I reload a page after routing to another page using Meteor and Iron Router

I'm developing a demo website using Meteor js. I want to click a button and go to another page directly. But after that, the new page needs to be reloaded automatically. The logic is like this:

Template.reload.events({
  'click #mybutton': function(){
     var index = ...//randomly generate an index;
     Router.go('/'+index);//I have Router.route("/:index" ) in router.js
     //I want to reload the new page after the going to a new page
  }

I think I can use document.location.reload(true); somewhere but I'm not sure where to put it. Any suggestions? Thanks

Upvotes: 0

Views: 518

Answers (1)

Ivan Barayev
Ivan Barayev

Reputation: 2055

Try this please You can use the Location.reload() method.

Template.reload.events({
  'click #mybutton': function(){
     var index = ...//randomly generate an index;
     Router.go('/'+index);//I have Router.route("/:index" ) in router.js
     document.location.reload(true);
  }

Upvotes: 1

Related Questions