只要字段值不为空字符串,我需要在我的ui-grid中显示一个按钮。我尝试使用ng-if
,但它没有起作用。这是我在网格选项中的代码:
{ field: 'ReleaseStatus',
width: 125,
displayName: 'Release Status',
cellTemplate:
'<div ng-if="row.entity.ReleaseStatus != """>
<button id="editBtn"
type="button"
class="btn btn-default"
data-toggle="modal"
data-target="#myModal"
ng-click="grid.appScope.launch(row)">
{{COL_FIELD}}
</button>
</div>'
},
没有
ng-if
时,按钮的显示和功能都非常好。然而,由于某些记录在 ReleaseStatus 字段上有空字符串,所以该按钮不应该出现。非常感谢您的帮助。