JSFiddle - React, Tailwind, and code Playground

by vishwackh89

HTML

<div ng-app>
    <div ng-controller="MyController">
        <h2>Names starting with "A":</h2>
        <ul>
            <li ng-repeat="player in players | filter:myCustomFilter">{{player.name}}</li>
        </ul>
        <h2>All Names:</h2>
        <ul>
            <li ng-repeat="player in players">{{player.name}}</li>
        </ul>
    </div>
</div>

JavaScript

function MyController($scope) {
    $scope.players = [{
        name: 'Arthur'        
    }, {
        name: 'William'
    }, {
        name: 'Bertha'
    },{
        name: 'Agra'
    }, {
        name: 'Alice'
    }];
    
    $scope.otherCondition = true;
    
    $scope.myCustomFilter = function(player) {
        return player.name.substring(0,1).match(/A/gi) && $scope.otherCondition;
    }
}