I am new to AngularJS. I am trying to filter the data set shown based on the option selected with a select box.
<div ng-controller="CurrentTrandetailsController">
<div>
<div class="pull-right">
<label for="show-filter" class="show-label">Show </label>
<select name="show-filter" ng-model="searchText.accruedcard" id="show-filter" ng-options="trandetail.accruedcard as trandetail.accruedcard for trandetail in currentTrandetails.trandetails ">
<option value="">All</option>
</select>
</div>
<h3>Current trandetails</h3>
</div>
<div>
<table class="table table-striped table-hover">
<tbody>
<tr ng-repeat="trandetail in currentTrandetails.trandetails | filter:searchText">
<td>{{trandetail.dateAccrued}}</td>
<td>{{trandetail.accruedcard}}</td>
<td>{{trandetail.placeAccrued}}</td>
<td>{{trandetail.discountcents}}</td>
<td>{{trandetail.shortExpiryDate}}</td>
</tr>
</tbody>
</table>
</div>
</div>
I used the example given in http://docs.angularjs.org/api/ng.filter:filter, which uses an input box to filter. On selecting a given card, it seems to filter fine. However, when I select "All", which has its value set to "", it doesn't display all the entries (clear the filter). However, in the example shown, when the text box is cleared, all the entries are displayed.
What am I doing wrong?