我的.html文件中有这个:
<tr ng-repeat="collab in collabs">
<td>{{collab.firstname}}</td>
<td>{{collab.lastname}}</td>
<td>{{collab.ext}}</td>
</tr>
collab.ext
是一个布尔值,我想在true
时显示是,在{{1}时显示否 }}
Angular会为此提供一些东西吗? : - )
答案 0 :(得分:0)
尝试使用&#34; ng-if&#34; ?
<div ng-if = "Variable == 5">
<!- we do whatever we want ->
</div>
<div ng-if = 'variable! = 5 ">
<!- we do whatever we want ->
</div>
答案 1 :(得分:0)
三元运营商if ? then : else
做得很好:
<tr ng-repeat="collab in collabs">
<td>{{collab.firstname}}</td>
<td>{{collab.lastname}}</td>
<td>{{collab.ext ? 'Yes' : 'No'}}</td>
</tr>