Aravinthan K Aravinthan K - 2 years ago 254
jQuery Question

ng-hide and ng-show not working Properly

I want to hide and show depending upon data values. I do not know what's wrong with my code. When I look for the data value by looking at console logs they print " [ ] "

My Controller

.success(function (data, status, headers, config) {
$scope.bills = data;

My Html Code


<div class="row" data-ng-hide='bills'>
<div class="alert alert-info">
<strong>No Bills!</strong> There is no history of bill for this

ng-show :

<table data-ng-show='bills' class="table table-hover">
<th class="col-lg-1 text-center">Bill No</th>
<th class="col-lg-1 text-center">Date</th>
<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>

My Problem is showing ng-show contents. Please help.

Answer Source

This works for me !

Thanks Nano

data-ng-show='bills.length > 0' 

data-ng-hide='bills.length > 0'



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download