JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-controller="KakaCtrl">
    Tab[id=777] index = <b>{{ getTabIndex( 777 ) }}</b>
</div>

JavaScript

function KakaCtrl( $scope , $filter ){

    var tabs = [ { id: 50 }, 
                 { id: 777 },
                 { id: -20 }];
    
    $scope.getTabIndex = function(id){
        var el = $filter('filter')( tabs , { id: id })[0];
        var el_index = tabs.indexOf( el );
        return el_index;        
    }
    
}