Angularjs UI 引导程序在打开时临时更改 URL 并在关闭时恢复为原始 URL [英] Angularjs UI bootstrap temporarily change URL on open and revert to original URL on close
本文介绍了Angularjs UI 引导程序在打开时临时更改 URL 并在关闭时恢复为原始 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 ui bootstrap modal 打开时临时更改浏览器 url(后面的页面应该保持原样,只有 url 更改).当模态关闭时,url 应该恢复到原来的.
I want to temporarily change the browser url when the ui bootstrap modal is opened ( The page behind should remain as is, only the url changes ). When the modal is closed the url should be reverted back to the original one.
步骤:
- 用户加载页面
- 网址:xyz.com/home
- 网址:xyz.com/detail/123
- 可能的解决方案:使用 html5 推送状态更改 url
- 问题:Angular ui-router 尝试根据更改后的 url 运行其路由,最终更改后台页面.
- 网址:xyz.com/home
- 可能的解决方案:html5 弹出状态
- 问题:重新加载后台页面,这破坏了目的
示例实现:Pinterest pin 及其 pin 详细信息弹出.
Example implementation : Pinterest pins and their pin details popup.
推荐答案
使用 https://github.com/christopherthielen/ui-router-extras/tree/gh-pages/example/stickymodal
这篇关于Angularjs UI 引导程序在打开时临时更改 URL 并在关闭时恢复为原始 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文