参考之前关于 DIV 内 ng-if 的帖子作为参考,这里给出的链接::DIV 内的 Ng-If,但是当我在表内使用 ng-if 与 td 上的 ng-repeat 尝试相同的操作时,它似乎效果不佳。如果我错了,请纠正我,我尝试了 2 次根据条件显示该列,但没有成功。下面我给出了代码供参考。有人可以帮我解决这个问题吗?如果您需要更多说明,请告知。
HTML
Try :: 1
<table>
<tr ng-repeat = "data in comments">
<td ng-if="data.type == 'hootsslllll' ">
//differnt template with hoot data
</td>
<td ng-if="data.type == 'story' ">
//differnt template with story data
</td>
<td ng-if="data.type == 'article' ">
//differnt template with article data
</td>
</tr>
</table>
Try :: 2
<table>
<tr ng-repeat = "data in comments">
<div ng-if="data.type == 'hootsslllll' ">
<td> //differnt template with hoot data </td>
</div>
<div ng-if="data.type == 'story' ">
<td> //differnt template with story data </td>
</div>
<div ng-if="data.type == 'article' ">
<td> //differnt template with article data </td>
</div>
</tr>
</table>
ng-if
应该为你工作try::1。这是小提琴工作示例
http://jsfiddle.net/shivaraj/n3xWB/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)