Can I filter ng-repeat with the $odd or $even properties?
Updated:
Or write a predicate function:
Working exmaple
Docs: ngRepeat
HTML:
<div data-ng-repeat="thing in things | filter:filterEvenStartFrom(0)">
<div>{{thing.name}}}</div>
</div>
JS:
$scope.filterEvenStartFrom = function (index) {
return function (item) {
return index++ % 2 == 1;
};
};
Original:
How about this:
<div data-ng-repeat="thing in things" ng-hide="$even">
<div>{{thing.name}}}</div>
</div>
This will show $even names of the things list.
<div ng-repeat="thing in things" ng-if="$even">
{{thing.name}}
</div>