【发布时间】:2014-04-12 10:07:43
【问题描述】:
我正在尝试有条件地显示具有 ng 样式的图像。 我已经尝试了here(以及文档中)列出的所有建议,但似乎没有任何效果。
first try:
<br/>
<img alt="" ng-style="{'background-image':'url(\'https://www.google.com/images/srpr/logo4w.png\')'}">
<br/>
second try:
<br/>
<img src="" alt="" ng-style="{'background-image':'url(\'https://www.google.com/images/srpr/logo4w.png\')'}">
<br/>
third try:
<br/>
<img src="" alt="" ng-style="{background-image:'url(https://www.google.com/images/srpr/logo4w.png)'}">
<br/>
fourth try:
<br/>
<img src="" alt="" ng-style="{background:'url(https://www.google.com/images/srpr/logo4w.png)'}">
这是JSFiddle
【问题讨论】: