简体   繁体   中英

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!

使用可以与jqlite一起使用:

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

I did it with:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM