如何在Xampp服务器上运行Angular应用程序? [英] How to run Angular app on xampp server?

查看:89
本文介绍了如何在Xampp服务器上运行Angular应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular 2和php.在使用Angular 2启动PHP之前,我已经在服务器localhost:3000上使用node.js完成了Angular 2.现在使用PHP,如何使用xampp服务器配置Angular 2应用程序,以便服务器代码在localhost:8080上运行.请帮我.

I'm working with Angular 2 with php. Before I started PHP with Angular 2. I have done Angular 2 with node.js on server localhost:3000. Now with PHP, how I can configure my Angular 2 app with xampp server so my server code is running on localhost:8080. Please help me on this.

推荐答案

这是我的答案.

您可以只使用Angular2软件包编写Angular2应用程序,而无需使用node或mamp或xampp并托管该应用程序. 参考

You can write Angular2 app just using Angular2 packages without using node or mamp or xampp and host that app. Ref

根据上述参考,我使用angular 2创建了我的应用-cli 之后,我对根目录的index.html文件进行了一些更改,即:

According to the above reference I created my app using angular 2 - cli after that I made a little change in my root directory index.html file which is:

<base href="/">

进入

<base href="./">

并使用以下内容构建我的应用程序:

and build my app using:

ng build --prod

复制dist文件夹并将其粘贴到我的xampp htdocs文件夹中,然后使用以下方法访问网站:

copy dist folder and paste it in my xampp htdocs folder and access the site using:

localhost:8080/dist/

localhost:8080/dist/

输出

应用正常

这篇关于如何在Xampp服务器上运行Angular应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆