Angular 2应用程序无法在Apache HTTP Server上运行 [英] Angular 2 app not working on Apache HTTP Server
问题描述
我将Angular 2应用程序复制到htdocs文件夹中的Apache HTTP Server 2.4上,但是它不起作用.
I copied my Angular 2 app on the Apache HTTP Server 2.4 in the htdocs folder, but it doesn't work.
index.html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Angular 2 app</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
如果尝试在浏览器中打开index.html页面,则在浏览器中仅看到文本正在加载...". Angular 2应用程序不会显示.
If I try to open the index.html page in the browser, I see only the text "Loading...." in my browser. The Angular 2 App is not displayed.
我该如何解决?
它可以在我使用Angular CLI的本地环境上正常工作.我需要找到一种使其在Apache HTTP Server 2.4上运行的方法.
我在本地唯一要做的就是运行npm start
.
It works on my local environment right, where I am using Angular CLI. I need to find a way to make it work on the Apache HTTP Server 2.4.
The only thing I have to do locally is to run npm start
.
推荐答案
您只需要在基本href <base href="./">
you just need to add a point in the base href <base href="./">
这篇关于Angular 2应用程序无法在Apache HTTP Server上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!