我想问你一个问题。 我的愿望是创建一个由4列组成的表,并在表数据(每行的第3和第4列)上显示绿色圆圈的图像,当变量(blocco1或blocco2)为真时,红色圆圈的图像为相同变量是假的。
这是我的代码
<tr ng-repeat="data in elencoTransazioni">
<td class="i9fontPre text-center" header-class="'i9header'">{{::data.code}}</td>
<td class="i9fontPre text-center" header-class="'i9header'">{{::data.desc}}</td>
<td class="i9fontPre text-center" header-class="'i9header'">
<img ng-if="data.blocco1=='true'" src="/i9web/mock/circleGreen.png">
<img ng-if="data.blocco1=='false'" src="/i9web/mock/circleRed.png">
</td>
<td class="i9fontPre text-center" header-class="'i9header'">
<img ng-if="data.blocco2=='true'" src="/i9web/mock/circleGreen.png">
<img ng-if="data.blocco2=='false'" src="/i9web/mock/circleRed.png">
</td>
</tr>
任何人都可以帮助我吗?
提前谢谢
答案 0 :(得分:2)
尝试使用ng-src
。
<tr ng-repeat="data in elencoTransazioni">
<td class="i9fontPre text-center" header-class="'i9header'">{{::data.code}}</td>
<td class="i9fontPre text-center" header-class="'i9header'">{{::data.desc}}</td>
<td class="i9fontPre text-center" header-class="'i9header'">
<img ng-src="{{data.blocco2 ? '/i9web/mock/circleGreen.png'
:'/i9web/mock/circleRed.png'}}">
</td>
</tr>
&#13;