JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-controller="KakaCtrl">
Indexes of {id:-20} : <b>{{ getTabsIndexes( -20 ) }}</b>
</div>
JavaScript
function KakaCtrl( $scope , $filter ){
var tabs = [ { id: 50 },
{ id: 777 },
{ id: -20 },
{ id: -20 }];
$scope.getTabsIndexes = function(id){
var els = $filter('filter')( tabs , { id: id });
var indexes = [];
if(els.length) {
var last_i=0;
while( els.length ){
indexes.push( last_i = tabs.indexOf( els.shift() , last_i ) );
}
}
return indexes;
}
}