简体   繁体   English

如何以角度配置服务器以获取文件?

[英]How to configure the server in angular to get files?

I just run the ng serve command and go to the server.我只是运行 ng serve 命令并转到服务器。 But if I drop the file house.jpg into the src folder, then when I access the address http://localhost:4200/house.jpg then I don't see this file, the main page of the project opens.但是如果我把 house.jpg 文件放到 src 文件夹中,那么当我访问地址http://localhost:4200/house.jpg 时,我看不到这个文件,项目的主页打开了。
I did not find anything about it in the official documentation, I ask the help of professionals官方文档里没找到,求专业人士的帮助

You need to follow the Angular Structure Guide .您需要遵循Angular Structure Guide As said above, you need to put your images and other files you want to use frontend-side in the assets folder.如上所述,您需要将要在前端使用的图像和其他文件放在assets文件夹中。

The assets folder contains image and other asset files to be copied as-is when you build your application. assets文件夹包含要在构建应用程序时按原样复制的图像和其他资产文件。

Notice you can create any folders you want in assets if you want to order your files.请注意,如果您想对文件进行排序,您可以在assets创建您想要的任何文件夹。

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

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