Create a list of numbers and use a filter to display only even numbers using angular js

<ul ng-app="filterApp" ng-controller="FilterController">
    <li ng-repeat="number in numbers | filter: isEven">{{ number }}</li>
</ul>

<script>
    var app = angular.module('filterApp', []);
    app.controller('FilterController', function($scope) {
        $scope.numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
        $scope.isEven = function(number) {
            return number % 2 === 0;
        };
    });
</script>

 

Post your Answer