My code has 4 tables and only 1 list, I used filter for this.
<table><tbody><tr ng-repeat="emp in details | filter:myFilter:1"></tbody></table>
<table><tbody><tr ng-repeat="emp in details | filter:myFilter:2"></tbody></table>
<table><tbody><tr ng-repeat="emp in details | filter:myFilter:3"></tbody></table>
<table><tbody><tr ng-repeat="emp in details | filter:myFilter:4"></tbody></table>
And my function:
$scope.myFilter = function (item, type) {
if (item != undefined) {
var condition1 = false;
var condition2 = false;
if (type == 1) {
condition1 = item.DetailType === 'G';
condition2 = item.IsException === false;
}
else if (type == 2) {
condition1 = item.DetailType === 'E';
condition2 = item.IsException === false;
}
else if (type == 3) {
condition1 = item.DetailType === 'G';
condition2 = item.IsException === true;
}
else if (type == 4) {
condition1 = item.DetailType === 'E';
condition2 = item.IsException === true;
}
return condition1 && condition2;
}
return false;
};
But I don't know why type
variable always has a value of 0
. I can't pass a 2nd paramter to ng-repeat
.