我试图根据数据库中的数据在表中显示图标。我有一个调用查询的函数,如果该数据存在,则返回一个布尔值,如果确实存在,我想在表上显示一个图标。我遇到的问题是,当我调用该函数时,该函数会无限次执行,我不确定为什么会这样。任何帮助将不胜感激!
这是将显示图标的表:
<table class="table table striped">
<thead>
<tr>
<th> ... </th>
<th> Exists? </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in myList">
<td> ... </td>
<td>
<i ng-show="callFunctionThatReturnsBoolean(item)" class="glyphicon glyphicon-thumbs-up" aria-hidden="true">
</i>
</td>
</tr>
</tbody>
</table>
您可以使用ng-show
。当ng-show condition
根据数据满足要求时,则显示图标,否则不显示。
我已经根据您的要求编写了一小段代码。
看来,
<td>
<span ng-show='item.flag'><i class="glyphicon glyphicon-user"></i></span>
{{item.flag}}
</td>
更新:
更新了plunker以将方法用于ng-show
。
工作柱塞
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句