Get all element keys for a Cell (Reference)

Hi Team,
Is there a directive that i could use to return a cell reference of all elements used to form a cell as object.

Instead of diving into the dataRow object and retrieving the cell elements through a for(){} loop.
See below code used

$scope.cellClicked = function(objRow, key){
        $scope.cellClickedElementsArray = [];
         $scope.commentaryElementsString = '';
         $scope.selectedElementsString = '';
         $scope.cellClickedElementsArraySelected = [];
        console.log(objRow, (key).toLowerCase(),  objRow[(key).toLowerCase().split(' ').join('')],  objRow[(key).toLowerCase().split(' ').join('')].elements    );
        var elementsObj =  objRow[(key).toLowerCase().split(' ').join('')].elements;
        var datasetElements =objRow[(key).toLowerCase().split(' ').join('')].dataset['elements'];
        var dimensionalityOrder = objRow[(key).toLowerCase().split(' ').join('')].dataset['dimensions']['order'];
        var dimensionalityRows = objRow[(key).toLowerCase().split(' ').join('')].dataset['dimensions']['rows']
        for(el in datasetElements){
            console.log(datasetElements[el]['name']);
            for(var nn = 0; nn < dimensionalityOrder.length; nn++){
                if(dimensionalityOrder[nn] === datasetElements[el]['dimension'] ){
                  if( nn != (dimensionalityOrder.length)-1 ){
                          $scope.cellClickedElementsArray[nn] = datasetElements[el]['name'];
                           $scope.cellClickedElementsArraySelected[nn] =  datasetElements[el]['name'];
                   }else{
                        $scope.cellClickedElementsArraySelected[nn] =  datasetElements[el]['name'];
                   }
                }
            }
           // $scope.cellClickedElementsArray.push(datasetElements[el]['name']);
        }
        for(item in elementsObj ){
            console.log(elementsObj[item]['name']);

            for(var nvn = 0; nvn < dimensionalityOrder.length; nvn++){
                if(dimensionalityOrder[nvn] === elementsObj[item]['dimension'] ){
                  if( nvn != (dimensionalityOrder.length)-1){
                         $scope.cellClickedElementsArray[nvn] = (elementsObj[item]['name']);
                          $scope.cellClickedElementsArraySelected[nvn] = (elementsObj[item]['name']);
                   }else{
                         $scope.cellClickedElementsArraySelected[nvn] = (elementsObj[item]['name']);
                   }
                }
            }

             // $scope.cellClickedElementsArray.push(elementsObj[item]['name']);
        }
        for(var hs = 0; hs < dimensionalityRows.length; hs++){
            var rowName = dimensionalityRows[hs];
            for(var sa = 0; sa < dimensionalityOrder.length; sa++){
                if(dimensionalityOrder[sa] === rowName ){
                    if(sa != (dimensionalityOrder.length)-1){
                     $scope.cellClickedElementsArray[sa] = (objRow[rowName].key);
                     $scope.cellClickedElementsArraySelected[sa] = (objRow[rowName].key);
                    }else{
                         $scope.cellClickedElementsArraySelected[sa] = (objRow[rowName].key);
                    }
                }
            }
             
        }
        $scope.commentaryElementsString = $scope.cellClickedElementsArray.toString();
        $scope.selectedElementsString = $scope.cellClickedElementsArraySelected.toString();
        $scope.commentaryOpen = true;
           
    } 

Thanks
Ilia

Hi Team,

$scope.cellClicked = function(objRow, key){
var elementsReference =  objRow[(key).toLowerCase().split(' ').join('')].reference();
// return the object with the reference of the cell clicked

}

Thanks to Paul L for answer
Ilia