0
Hello, I need to take an HTML element after an ng-repeat, to apply CSS commands in the div in which it depends on the result that comes from the database. For now I can only catch this element, but Style is applied only in the first repeat item, and I need to apply in the others also with different Style’s. Is there any better way to get this element through an index?
HTML code:
<tr ng-repeat = "fornecedor in fornecedores" on-finish-render="ngRepeatFinished">
<td>{{fornecedor.nome}}</td>
<td>
<div class="chart-agendamento">
<div id="agendamento">{{fornecedor.agendamento}}</div>
</div>
</td>
<tr>
Javascript code
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
for(var i = 0; i < $scope.fornecedores.length; i++){
document.getElementById('agendamento').style.width="100px";
}
What I need to do is basically take this "Schedule" id along with some index that comes back from the table in HTML, so I can run it. Does anyone know any way to use this getElementById working that way? Or some better way to do what I want in different ways?
Thank you very much!! Through his answer I went to study getElementsByClassName and found that it returns me an array of elements, and this way I can identify which element I want to reference through the sequence. Thanks :)
– Lucas Hananni