[英]ng-hide and ng-show not working Properly
我想根据数据值隐藏和显示。 我不知道我的代码有什么问题。 当我通过查看控制台日志来查找数据值时,它们会打印“ []”
我的控制器
$http.get('/bill/billByPatientId/'+patientData.id)
.success(function (data, status, headers, config) {
console.log(data);
$scope.bills = data;
});
我的HTML代码
ng-hide:
<div class="row" data-ng-hide='bills'>
<div class="alert alert-info">
<strong>No Bills!</strong> There is no history of bill for this
patient
</div>
</div>
ng-show:
<div>
<table data-ng-show='bills' class="table table-hover">
<thead>
<tr>
<th class="col-lg-1 text-center">Bill No</th>
<th class="col-lg-1 text-center">Date</th>
</tr>
</thead>
<tbody class="scrollable">
<tr data-ng-repeat="bill in bills">
<td class="text-center">{{bill.billNo}}</td>
<td class="text-center">{{bill.billDate | date:'dd-MM-yyyy'}}</td>
</tbody>
</table>
</div>
我的问题是显示ng-show内容。 请帮忙。
这对我有用!
谢谢纳米
data-ng-show='bills.length > 0'
data-ng-hide='bills.length > 0'
要么
data-ng-show='bills[0]'
data-ng-hide='bills[0]'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.