HTML:
状态
选择一个状态
住< /选项>
调度< /选项>
过期< /选项>
保存< /选项> - >
名称
<div class="col-md-3">
<div class="form-group">
<button class="btn btn-default btn-lg btn-block button-red" style="margin-top:1em;" class="form-control"
ng-click="applySearchFilter()">filter</button>
</div>
</div>
<table ng-table="tableParams" class="table table-striped" style=" text-align: center;">
<tr ng-repeat="product in $data" ng-hide="product.excludedByFilter">**strong text**
Controller.js
$scope.applySearchFilter = function() {
var nameFilter = $scope.filters.title;
var statusFilter = $scope.filters.status.name;
var showAll = 0 === nameFilter.length && 0 === statusFilter.length;
// $scope.tableParams = $filter(statusFilter)($scope.tableParams, tableParams);
angular.forEach($data, function(product) {
if (showAll) {
product.excludedByFilter = false;
console.log("value in if::::"+product.title);
} else {
console.log("value is::::"+product.title);
product.excludedByFilter = (product.title.indexOf(nameFilter) === -1)
|| ($scope.data.status.indexOf(statusFilter) === -1) ;
}
});
$scope.tableParams.reload();
}
$scope.$watch("applySearchFilter", function () {
$scope.tableParams.reload();
});
我试图通过点击过滤按钮
在同一个ng-table上显示过滤数据