【发布时间】:2015-11-04 23:19:46
【问题描述】:
我的带有 ui-router 的 Angular 应用程序在 /content/page.html 的页面内运行。该页面还有一个
<base href="/somewhere">
标签在头部。
由于基本标记,我最终得到了指向 /somewhere#/section1 而不是 /content/page.html#/section1 的错误 URL
我无法删除此基本标记,因为我只是大型网站的一小部分。有没有办法让 ui-router 默认生成绝对 URL?我注意到ui-sref-opts="{absolute: true}" 可以做到这一点,但它使用基本标签生成链接。有没有办法让 ui-router 总是使用 window.location.pathname 创建绝对 URL?
编辑:我创建了 this plunker 来演示问题。
问候,马库斯
【问题讨论】:
标签: angularjs angular-ui-router