I want to add some icons to elements I created with angularJS directly after creating them. So I am calling the function to set the icons at the same time the elements were created.
data-ng-click="opeTab($event); getObjects($event); loadObj($event); setIcons();"
The problem is, I can get the elements with:
$scope.setIcons = function(){
var tbs = document.getElementsByClassName("tabTr");
for(let i = 0; i < tbs.length; i++){
console.log(i);
tbs[i].style.backgroundImage = "url('../ICONS\Icons_24\'" + tbs[i].id + "')";
}
}
And the list in the console is filled, but the length of the array is 0. So what possibility do I have to "wait" for the creation except setting a timeout?
created dynamicallygets created?loadObj($event);be asynchronous ?