How to run Angular 2 application without running a server? I need to take just one folder which contains index.html (some css, js additionally)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you use angular-cli you can do ng build --prod
. The index.html will be in the dist folder.
回答2:
Completing Admir Sabanovic's answer. In your app.module.ts add as provider
providers: [
{ provide: LocationStrategy, useClass: HashLocationStrategy }
]
In your index.html change the line < base href="./" > by
<script>document.write("<base href='"+window.location.href+"'/>") </script>