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
- Bokeh Div文本对齐 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
