【发布时间】:2018-12-05 04:29:20
【问题描述】:
在使用 ng build 构建我的 Angular 应用程序时,我为我的应用程序提供了 --base-href 标志作为 foo。所以我的应用程序的 URL 看起来像 https://10.10.10.19:8080/foo。但是我想导航到一个在 URL 中有 bar 的页面,即https://10.10.10.19:8080/bar。
我尝试了 router.navigateByUrl('/bar') 但它创建了一个 URL https://10.10.10.19:8080/foo/bar,这不是我想要的。
有人可以帮我解决这里丢失或出错的问题吗?
【问题讨论】:
-
显示你的代码
-
具体来说,向我们展示您的路由文件。并尝试更改 index.html 中的 baseHref = "/"
-
为您的应用设置基础在我发表的一篇文章中进行了说明,希望对您有所帮助:joeljoseph.net/…
标签: angular angular-routing angular-router