angular ui-router:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载? [英] angular ui-router: how do I reload a state when a path parameter changes but not reload when a query parameter changes?

查看:30
本文介绍了angular ui-router:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我希望导航中的这种更改重新加载状态:

For example, I want this change in navigation to reload the state:

  • #/detail/1
  • #/detail/2

但我不希望这个导航重新加载状态:

But I do not want this navigation to reload the state:

  • #/detail/1?search=blah
  • #/detail/1?search=huzzah

根据 ui-router 文档,设置 reloadOnSearch: false 应该可以完成此操作,但请尝试下面的 plunk.当 reloadOnSearch === false 时,更改路径参数不会重新加载状态,即使文档说明它应该这样做.

According to the ui-router documentation, setting reloadOnSearch: false should accomplish this, but try the plunk below. When reloadOnSearch === false, changing the path parameter doesn't reload the state even though the documentation says it should.

Plunkr:http://run.plnkr.co/ZPy9uabYlkMilwdS/#/param

推荐答案

这是 UI-Router 中的一个错误,已在 0.2.15 版本中修复:

This is a bug in UI-Router that was fixed in release 0.2.15:

https://github.com/angular-ui/ui-router/releases

升级到最新版本将解决问题

Upgrading to the latest will fix the issue

这篇关于angular ui-router:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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