【发布时间】:2017-06-13 16:56:48
【问题描述】:
我正在使用相对路径在我的应用程序中显示图像。在我将应用程序更新到最新版本的 Angular (4.1.3) 之前,它一直运行良好。 我没有任何错误,我的图像也不再显示。
我在app.component.html:
<img src="/src/images/settings.png" />
我的应用结构:
► e2e
► node_modules
► obj
▼ src
▼ app
app.component.html
app.component.ts
app.module.ts
► assets
► environments
▼ images
settings.png
index.html
main.ts
polyfills.ts
styles.css
tsconfig.app.json
tsconfig.spec.json
typing.d.ts
.angular-cli.json
.editorconfig
.gitignore
karma.conf.js
package.json
protactor.conf.js
tsconfig.json
tslint.json
我尝试了this question 中建议的许多路径,但没有一个有效。这个问题的不同之处在于我没有任何错误,我的应用程序正在运行,图像只是没有显示。 奇怪的是,在我更新我的应用程序之前它运行良好。
这可能来自哪里的任何想法?
【问题讨论】:
-
您应该添加
angular-cli作为标签。我认为这里很重要。
标签: html image angular angular-cli