Angular 2 \ 4 hash url keep index.html

时间:2017-06-18 13:47:12

标签: angular

背景:Angular 4,ng cli,RouterModule,useHash:true。

当我使用http://server/index.html浏览我的应用时,它会解析为http://server/#/(从网址中省略index.html),此外每个路由导航也会从网址中省略index.html。

这对我的应用程序托管方式有问题,我需要将index.html保留在网址中。如何配置角度以保持角度?

1 个答案:

答案 0 :(得分:2)

您可以尝试: ng build --prod --base-href /app/index.html

但它可能会影响您资产的相对路径。

相关问题