简体   繁体   English

Angular 2.在共享主机上运行

[英]Angular 2. Run on shared hosting

I am started with AngularJS 2: 我开始使用AngularJS 2:

  • Instaled NodeJS Instaled NodeJS
  • Downloaded start project 下载启动项目
  • Run on Node 在节点上运行

All works! 一切都有效!

However how to run it in production on shared hosting (without Node ant not on vps)? 但是如何在共享主机的生产中运行它(没有Node不在vps上)? How to open in browser by clicking on index.html? 如何通过点击index.html在浏览器中打开?

You have to command ng build --prod . 你必须命令ng build --prod

This will build your app into the dist folder. 这会将您的应用程序构建到dist文件夹中。
Copy the contents of your dist folder to the public directory of your shared hosting. 将dist文件夹的内容复制到共享主机的公共目录。

Answered here: https://stackoverflow.com/a/40854458/2816279 这里回答: https//stackoverflow.com/a/40854458/2816279

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 plunkr here and extract it to your required folder in your shared hosting, that's all. plunkr下载它并将其压缩到您共享主机中的所需文件夹,就是这样。

Source: https://angular.io/docs/js/latest/quickstart.html 资料来源: https//angular.io/docs/js/latest/quickstart.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM