angular ui-router: how do I reload a state when a path parameter changes but not reload when a query parameter changes?(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:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:angular ui-router:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载?


- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Fetch API 如何获取响应体? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01