找不到Angular 4 img src [英] Angular 4 img src is not found
本文介绍了找不到Angular 4 img src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
获取角度为4的图像时遇到问题.它一直告诉我找不到图像.
I'm having a problem with sourcing an image with angular 4. It keeps telling me that the image is not found.
文件夹结构:
app_folder/
app_component/
- my_componenet
- image_folder/
- myimage
我正在使用mycomponent
中的图像.如果在mycomponent
中,则直接将其插入:
I am using the image in mycomponent
. If in mycomponent
, I insert it directly with:
<img src="img/myimage.png"
这工作正常,但我检查了html并创建了一个哈希.但是我的图片必须动态添加到html中,因为它们是列表的一部分.所以,如果我使用:
This works fine, but I checked the html and it creates a hash. But my images have to be dynamically added to the html because they are part of a list. So, if I use:
<img src="{{imagePath}}">
基本上是img/myimage.png
,它不起作用.如果我使用:
which is basically img/myimage.png
, it doesn't work. If I use:
<img [src]="imagePath">
它说NOT FOUND (htttps://localhost/img/myimage.png)
.你能帮我吗?
推荐答案
AngularJS
AngularJS
<img ng-src="{{imagePath}}">
角度
<img [src]="imagePath">
这篇关于找不到Angular 4 img src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文