简体   繁体   English

Angular4-示例项目的空白页

[英]Angular4 - Blank page for sample project

I'm trying to learn angular4 by following the Quick Start Page by angular.io . 我正在尝试通过angular.io跟随快速入门页面来学习angular4 After Step3 given in this guide, I'm able to see the web page. 完成本指南中的Step3之后,我可以看到该网页。 Out of curiosity I tried running the server from project root directory instead of "src" directory. 出于好奇,我尝试从项目根目录而不是"src"目录运行服务器。 But this time I'm getting a blank page. 但是这次我得到的是空白页。 I can see the HTML elements from browser "source code". 我可以从浏览器“源代码”中看到HTML元素。 Do I have to make anything updated to make it working? 我是否需要进行任何更新才能使其正常工作?

URL which I used: 我使用的网址:

http://localhost/myapp/src/

// Editing because I misread your question initially. //正在编辑,因为我最初误读了您的问题。

Check out .angular-cli.json . 检出.angular-cli.json It specifies the main and index files for your project. 它指定项目的主文件和索引文件。 You could probably get away with changing "main" to be src/ plus whatever it is now. 您可能可以通过将“ main”更改为src/加上现在的内容来摆脱。 Note that for a single-page application, you generally won't be navigating to a sub-directory -- just the hostname / port of the server. 请注意,对于单页应用程序,通常不会导航到子目录-只是服务器的主机名/端口。 So you're probably seeing raw code in your browser. 因此,您可能会在浏览器中看到原始代码。

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

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