JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-controller="KakaCtrl">
    
    <button ng-click="search(-20);">press  me</button>
    <div><pre>{{indexes | json}}</pre></div>
</div>

JavaScript

function KakaCtrl( $scope , $filter ){
    
    $scope.tabs = [ { id: 50 }, 
                 { id: 777 },
                 { id: -20 },
                 { id: -20 }];

    $scope.indexes = [];    
         
     $scope.search = function(selectedItem) {         
         
        $filter('filter')($scope.tabs, function(item) {
                                   
            if(selectedItem == item.id){             
                 $scope.indexes.push( $scope.tabs.indexOf(item)  );               
                return true;
            }

            return false;
        });       
     } 
    
}