我们在IIS中运行角度应用程序作为虚拟应用程序“myapplication”
在我的angular app中,我在index.html中设置了:
<base href="/myapplication/">
它在IIS工作正常。但是现在NG服务不起作用。因为它无法在http://localhost/myapplication/下找到所有捆绑包,因为CLI未在该路径下运行。
我试过了
ng serve --base-href /myapplication/
并浏览到http://localhost:4200/myapplication/
我仍然看到同样的错误。
如何告诉CLI在“http://localhost:4200/myapplication/”下提供应用程序?
答案 0 :(得分:2)
将基础href更改为:
<base href="/">
设置开发时间的默认值。
然后,当您为生产构建时,请使用:
ng serve --base-href /myapplication/
这将在构建部署文件时正确设置。
答案 1 :(得分:0)