Angular 2 without Webserver

可紊 提交于 2021-01-28 11:13:02

问题


How can I use Angular 2 in production without webserver and just the filesystem? I can't use a webserver because of the corporate policies (that was not a problem with Angular because I could use the filesystem).


回答1:


If you don't need network, Angular (version 2 and higher) applications work with no problems over the file:/ protocol. But you must set a correct base href path in your index.html. If you are using Angular CLI, you can build the app using the following command:

ng build --base-href=/path/to/your/application/dist/

and then opening the file:///path/to/your/application/dist/index.html in your browser.



来源:https://stackoverflow.com/questions/43536647/angular-2-without-webserver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!