How do I reload the current iron:router route?

后端 未结 2 662
轮回少年
轮回少年 2021-01-18 06:43

If I\'m currently at /foo, Router.go \'/foo\' does nothing. I would like /foo\'s action hooks and rendering to be redone. I know I cou

2条回答
  •  走了就别回头了
    2021-01-18 06:59

    There is a way with iron router:

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

    I wouldn't recommend it though. Isn't there a way to rewrite it so it doesn't need to reload?

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

提交回复
热议问题