所以我重复列出以下数组:
<ion-checkbox ng-repeat="item in items | startFrom: currentPage*pageSize | limitTo: pageSize | filter: filterAll as filtered" ng-model="item.selected" ng-show="items.length" item="item" ng-class-even="'fade even'" ng-class-odd="'fade odd'">
过滤时间:
listModule.filter('startFrom', function () {
return function (input, start) {
if (input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
$scope.filters = {
RowNr: "",
LocationNr: "",
ItemType: "",
ItemOwner: ""
};
$scope.filterAll = function () {
var result = $filter('filter')($scope.items, $scope.filterFn);
console.log(result.length);
return result;
}
$scope.filterFn = function (item) {
var result = true;
for (var filter in $scope.filters) {
var obj = $scope.filters[filter];
if (result) {
if (angular.isUndefined(obj) || obj == null || obj == "" || filter == "ItemType" || filter == "ItemOwner") {
result = true;
}
else if (filter == "LocationNr" || filter == "RowNr") {
result = item[filter] === parseInt(obj);
} else {
result = item[filter] == obj;
};
}
}
return result;
};
我在$ scope.filterAll中可以看到正确的结果长度,当我在过滤器输入中键入内容但显示给用户的数组不会更新过滤内容?