路径导航到文件夹角度

时间:2017-08-04 08:47:20

标签: html angular

我正在尝试将本地图像的路径写入项目,它似乎向我展示了一个未定义的图像。 enter image description here

你可以看到我在app.component.html中 我想做

src="img/profile.png"

但在浏览器中我收到此错误

profile.png Failed to load resource: the server responded with a status of 404 (Not Found)

路径错了吗?

2 个答案:

答案 0 :(得分:3)

您需要在img文件夹之外的资源中创建此src文件夹。然后尝试使用下面的路径

<img src="./assets/img/profile.png">

答案 1 :(得分:3)

我找到了解决方案。 我只是将文件夹img移动到资源,然后我写了这行

src="assets/img/profile.png"
相关问题