如何重新加载当前的iron:router路由? [英] How do I reload the current iron:router route?

查看:75
本文介绍了如何重新加载当前的iron:router路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我目前在/fooRouter.go '/foo'则不执行任何操作.我希望重做/foo的动作挂钩和渲染.我知道我可以建立一个依赖关系,在动作钩子中提及它,并在需要重新加载时使其无效,我只是希望可以使用一个Router.* api,因为这样做会更清洁.

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 could make a dependency, mention it in an action hook, and invalidate it when I need to reload, I'm just hoping there's a Router.* api I can use, because that would be cleaner.

推荐答案

这将添加一个起作用的函数Router.rerun():

This adds a function Router.rerun() that works:

login_dep = new Tracker.Dependency

Router.rerun = ->
  login_dep.changed()

Router.configure
  onBeforeAction: ->
    login_dep.depend()
    ...

这篇关于如何重新加载当前的iron:router路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆