typescript Angular 2. 在共享主机上运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36558096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Angular 2. Run on shared hosting
提问by AndersonDev
I am started with AngularJS 2:
我从 AngularJS 2 开始:
- Instaled NodeJS
- Downloaded start project
- Run on Node
- 已安装的 NodeJS
- 下载的启动项目
- 在节点上运行
All works!
所有作品!
However how to run it in production on shared hosting (without Node ant not on vps)? How to open in browser by clicking on index.html?
但是,如何在共享主机上的生产中运行它(没有 Node ant 不在 vps 上)?如何通过单击 index.html 在浏览器中打开?
回答by Pedro Ferreira
You have to command ng build --prod
.
你必须命令ng build --prod
.
This will build your app into the dist folder.
Copy the contents of your dist folder to the public directory of your shared hosting.
这会将您的应用程序构建到 dist 文件夹中。
将 dist 文件夹的内容复制到共享主机的公共目录。
Answered here: https://stackoverflow.com/a/40854458/2816279
回答by user1685442
You dont need anything else other than importing a few javascript files in your index.html file.
除了在 index.html 文件中导入一些 javascript 文件之外,您不需要其他任何东西。
Check this live example
检查这个现场例子
Download it from plunkrhere and extract it to your required folder in your shared hosting, that's all.
在这里从plunkr下载它并将其解压缩到共享主机中所需的文件夹中,仅此而已。