在 raspberry pi 上使用 Angular 服务器找不到图像
Image not found using Angular server on raspberry pi
我已经使用 Angular 设置了我的 Raspberry pi。仅使用基本 ng serve
命令创建一个简单的网站。
第一件事是我想添加自己的图像。但是,每次我尝试 src 到我的图像时都找不到:
<img src="air.JPG">
如果我再次尝试 运行 Angular favicon.ico
提供的图像标准。然后它确实有效
<img src="favicon.ico">
不知为何能找到一个而另一个找不到?
我正在从我的计算机外部访问该网站。服务器通过命令 ng serve --host 0.0.0.0
.
托管
Failed to load resource: the server responded with a status of 404 (Not Found)
or if go from an external ip address:
GET http://212.204.xxx.xx:xxxx/air.JPG 404 (Not Found)
(left out a few xxxx for privacy :p)
我已经尝试过上下移动图像(也移动到资产中)。我试过使用覆盆子的完整路径。我试过给出IP地址和路径。
所有不在现有资产文件夹中的新资产都需要添加到 angular.json 的 "assets" 部分文件。
注意 - 文件中有两个资产部分。一份用于构建,一份用于 运行 测试。
我已经使用 Angular 设置了我的 Raspberry pi。仅使用基本 ng serve
命令创建一个简单的网站。
第一件事是我想添加自己的图像。但是,每次我尝试 src 到我的图像时都找不到:
<img src="air.JPG">
如果我再次尝试 运行 Angular favicon.ico
提供的图像标准。然后它确实有效
<img src="favicon.ico">
不知为何能找到一个而另一个找不到?
我正在从我的计算机外部访问该网站。服务器通过命令 ng serve --host 0.0.0.0
.
Failed to load resource: the server responded with a status of 404 (Not Found) or if go from an external ip address: GET http://212.204.xxx.xx:xxxx/air.JPG 404 (Not Found) (left out a few xxxx for privacy :p)
我已经尝试过上下移动图像(也移动到资产中)。我试过使用覆盆子的完整路径。我试过给出IP地址和路径。
所有不在现有资产文件夹中的新资产都需要添加到 angular.json 的 "assets" 部分文件。
注意 - 文件中有两个资产部分。一份用于构建,一份用于 运行 测试。