Using Meteor with Iron:Router, js to open a route with a guaranteed refresh

We have js code for Iron:Router to go to a new route:

Router.go('/');

We have code to reload and page:

window.location.reload(true);

What is the code to accomplish both of these at once (so that the user goes to the new route and the page is guaranteed to reload)?

Thanks

Answers


You can insert your reloading statements into the template if there's only one template rendering in the route.

Template.name.onRendered(function(){
 // reloading code goes here.
});

Or you can use onAfterAction hook of Iron router to accomplish the reload.

http://iron-meteor.github.io/iron-router/


Simple Answer, just like plain HTML5:

window.location.href = "/";

This will reload the entire app (which is what was desired in this case).


Need Your Help

JAXB Marshal and Unmarshal Map to/from <key>value</key>

dictionary jaxb key-value unmarshalling

I'm trying to marshal and unmarshal Map to/from value pairs. I can marshal the object successfully, however, I cannot unmarshal it from the xml. The unmarshal result is the key exist in the Map, ho...

Reversing of string

java reverse

I have a string as Apple->Ball->Cat->Dog and want to reverse it as Dog->Cat->Ball->Apple. It can be done by splitting the string at every '->' and then adding each element is an array and then reve...