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:如何在路径参数更改时重新加载状态,但在查询参数更改时不重新加载?


基础教程推荐
- 每次设置弹出窗口的焦点 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01