angular - Angular 8 Unable to access images in assets folder
问题描述
I'm unable to access the images available in the assets folder:
src
|->app
|->assets
|->images
|->image1.jpg
|->image2.png
in app.component.html
src
|->app
|-> app.component.html
I'm trying to use these images
<img src="../assets/images/image1.jpg"/>
<img src="../assets/images/image2.png"/>
Even I have added this in angular.json
"assets": [
"src/favicon.ico",
"src/assets",
"src/assets/images/image1.jpg",
"src/assets/images/image2.png"
],
images are showing like this:
Please let me how to fix it
Thanks in advance.
解决方案
尝试:
<img src="/assets/images/image1.jpg"/> <img src="/assets/images/image2.png"/>
推荐阅读
- python - 在python中,将函数应用于列表的最有效方法是什么
- node.js - 如何使用 NodeJS 中的 REST API 在 twilio 可编程聊天中对频道进行分页
- python-3.x - Python - 仅使用空格不解决编译时的类方法“IndentationError”?
- abaqus - Abaqus 中 B21(Timoshenko 梁)单元的形状函数
- mysql - 除了 sum 之外,我还应该使用什么函数来对数据库中注册的一定数量文档的值求和?
- javascript - 克隆 HTML 画布及其内容
- amazon-s3 - 通过 AWS 粘合作业在目标数据库中添加主键
- python-3.x - Python tkinter-通过按钮单击进行线程化
- javascript - 如何发送带有 cookie 的自定义标头
- regex - 正则表达式替换路径到姓氏,如果它有扩展名