[英]Angular 4 img src is not found
我在使用 angular 4 获取图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我正在使用mycomponent
中的图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了 hash。 但是我的图像必须动态添加到 html 因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
我在获取角度为 4 的图像时遇到问题。它一直告诉我找不到图像。
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我在mycomponent
使用图像。 如果在mycomponent
,我直接插入它:
<img src="img/myimage.png"
这工作正常,但我检查了 html 并创建了一个哈希。 但是我的图像必须动态添加到 html 中,因为它们是列表的一部分。 所以,如果我使用:
<img src="{{imagePath}}">
这基本上是img/myimage.png
,它不起作用。 如果我使用:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
。 你能帮助我吗?
这是我的问题,我添加了 src/app/types/types.d.ts 的内容:
declare module '*.png' {
const value: any
export default value
}
declare module '*.jpg' {
const value: any
export default value
}
declare module '*.svg' {
const value: any
export default value
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.