This is also a general question.
In my example I have to edit the DOM on a Leaflet Map to manipulate the appearance of the legend. We used $timeout as a workaround because the map isn't generated fast enough to get the elements in the map.
So I wanted to know if this is a dirty/messy workaround and if this could be done better than using $timeout?
As suggested some code. The activate function is one of the initiating functions of the map.
controller.js
function activate() {
projectService.getMarkers(vm, 'projectsData');
$timeout(function() {
manipulateLegend();
});
}
$apply.