How to use ng-repeat to iterate over an array and apply a filter to display only items that meet a certain condition in angularJS

<ul ng-app="repeatFilterApp" ng-controller="RepeatFilterController">
    <li ng-repeat="item in items | filter: {price: '>20'}">{{ item.name }} - ${{ item.price }}</li>
</ul>

<script>
    var app = angular.module('repeatFilterApp', []);
    app.controller('RepeatFilterController', function($scope) {
        $scope.items = [
            { name: 'Item 1', price: 10 },
            { name: 'Item 2', price: 25 },
            { name: 'Item 3', price: 30 }
        ];
    });
</script>

 

Post your Answer