I have a sales array and I want to filter by the status of the sale action (finished, pending or/and failed). What I am trying is to show entire list, and unchecking the checkboxes some rows will disapear.
HTML Code
<div class="row" ng-repeat="sale in salesArray | filter: okStatus | filter: pendingStatus | filter: failedStatus">
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
<i ng-class="'icon ' + sale.icon + ( sale.status == 'ok' ? ' text-green' : (sale.status == 'pending' ? ' text-amber' : ' text-red') )"></i>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<|sale.user|>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<|sale.product|>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<|sale.price | currency:"$"|>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<|sale.date|>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
</div>
</div>
<ul class="justified-list">
<li>
<div class="checkboxer checkboxer-green form-inline">
<input type="checkbox" id="checkboxColor10" ng-model="okStatus" ng-value="ok">
<label for="checkboxColor10">Finalizados (<|(salesArray | filter: {status: 'ok'}).length|>)</label>
</div>
</li>
<li>
<div class="checkboxer checkboxer-amber form-inline">
<input type="checkbox" id="checkboxColor14" ng-model="pendingStatus" ng-value="pending">
<label for="checkboxColor14">En proceso (<|(salesArray | filter: {status: 'pending'}).length|>)</label>
</div>
</li>
<li>
<div class="checkboxer checkboxer-red form-inline">
<input type="checkbox" id="checkboxColor1" ng-model="failedStatus" ng-value="failed">
<label for="checkboxColor1">Abortados (<|(salesArray | filter: {status: 'failed'}).length|>)</label>
</div>
</li>
</ul>
Controller Code:
$scope.okStatus = "";
$scope.pendingStatus = "";
$scope.failedStatus = "";
$scope.salesArray = [
{icon: "ion-checkmark-round", user: "Jtd", price: 123.32, product: "Sesión de una hora", date: "12/02/2015", status: "ok"},
{icon: "ion-close-round", user: "Tar", price: 53.00, product: "Sesión de media hora", date: "14/02/2016", status: "failed"},
{icon: "ion-compass", user: "Rao", price: 103.90, product: "Sesión de 45 minutos", date: "15/03/2016", status: "pending"}
];
How can I get this filter? Is obvious now it is not working