aurelius
aurelius

Reputation: 4076

How to get dom element by attribute with AngularJS

I have a page where I have a table and a grid, and when I click on row from the grid:

    gridApi.selection.on.rowSelectionChanged($scope, function(row) {
        $scope.formula = row.entity.formula;
        console.log(row.entity.factId);
    });

I want a certain cell from the table to be highlighted.

based on the factid attribute.

<div factid="1010898">320.00</div> 

What is the best angular way without using any external library like jquery, jqlite from angular being ok to use.

Thanks!

Upvotes: 1

Views: 52

Answers (2)

aurelius
aurelius

Reputation: 4076

I did it with:

$('#report-content').find('[factid = ' + row.entity.factId + ']');

where "report-content" is the id of the container.

Upvotes: 0

Aminadav Glickshtein
Aminadav Glickshtein

Reputation: 24650

Use can do with jqlite:

angular.element('[factid=1010898]')

Upvotes: 1

Related Questions