如何为Angular应用程序设置基本URL [英] How to set base url for Angular application

查看:131
本文介绍了如何为Angular应用程序设置基本URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由JHipster生成的Angular应用程序.默认情况下,它在根/ URL上运行,并重定向到/#/.有没有办法将其覆盖到其他东西?

I have an Angular application as generated by JHipster. By default, it runs on the root / url, and redirects to /#/. Is there a way to override it to something else?

修改

对不起,我不得不改写我的问题,因为下面的所有答案都对它有误解.我想将我的JHipster生成的Angular应用程序放到/以外的其他地方,例如/crud/.目的是在/上提供一些非角度内容.如何将整个应用程序从/移到/crud/?仍然有/由静态index.html文件提供服务吗?

Sorry, I have to rephrase my question, as it is misinterpreted in all answers below. I want to land my JHipster generated Angular application on something other than /, eg /crud/. The purpose is to serve some non-Angular content on /. How can I move the entire application from / to /crud/? And still have / served by a static index.html file?

推荐答案

在构建项目时最好这样做.像这样:

Better to do it when you build project. Like this:

ng build --prod --base-href=/test/

这篇关于如何为Angular应用程序设置基本URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆