When you click on an iron router link, MeteorJS will change the template that is being renderd into the page. this is not a traditional page reload.
how can i achieve this programically?
for example: i have a hyperlink defined by "{{pathFor 'settings'}}"
, clicking on it will change the template being displayed to the 'settings' template. but when i do this programatically with "window.location='http://localhost/settings'"
, a page refresh is triggered and any variables i may have initialised are gone.
i think i can achieve the result i want by adding a 'trigger click' event in jquery, but i was wondering if there is a better/simpler solution available
You have to use Router.go('settings');
. You can either provide a path or a route name if you set one.