我正在使用 ionic v1 这是我的文件夹结构。
www\tempaltes\acct\
在我的 acct 文件夹下,我有 acct-home.html 和 patient_default.png
我正在尝试使用此代码在 acct-home 中显示我的 patient_default.png。
<img src="patient_default.png" alt="Test" width="100px" height="100px">
请注意,acct-home.html 和 patient_default.png 位于同一文件夹中。 但它不能正确显示。 我做错了吗?非常感谢您的帮助。
更新问题:
这是我的文件夹结构
root
--API
--patient_default.png
--Www
--templates
--acct
--acct-home.html
我试过用
<img src="../../API/patient_default.png" alt="Test" width="100px" height="100px">
它什么也没显示。
最佳答案
不要将模板文件夹用作绝对路径头。
改用index.html,它会起作用!
index.html 将使用 .html 模板,但对于 Ionic,引用始终是 index.html。
关于angularjs - Ionic v1 中的 img src 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43407901/