How to reload the current route: router?

If I'm in /foo right now, Router.go '/foo' does nothing. I would like for /foo intercept and render actions. I know that I can make a dependency, mention it in case of action, and cancel it when I need to reboot, I just hope that there will be a Router.* Api, because it will be cleaner.

+7
meteor iron-router
source share
2 answers

This adds the Router.rerun() function, which works:

 login_dep = new Tracker.Dependency Router.rerun = -> login_dep.changed() Router.configure onBeforeAction: -> login_dep.depend() ... 
+3
source share

There is a way with an iron router:

 Router.current().render(Template.yourMainTemplateName).data(); 

I would not recommend it. Is there no way to rewrite it so that it does not need to be reloaded?

Another solution (perhaps better, depends on the use case) is to have the autostart function in your main template display a callback. If you define your dependencies with Template.getData (), it should run the code inside whenever the data changes.

0
source share

All Articles