I'm currently attempting to adjust the margin of a specific element within the link function.
This is what my code looks like:
scope.size = (($("#highlight .thumbs li").width() * $("#highlight.thumbs li").size()) + (20 * ($("#highlight.thumbs li").size() - 1)));
elem.find(".thumbs").addClass({ width : scope.size});
The issue lies in the fact that scope.size
within the link function is showing as -20px;
When I incorporate the code into a $timeout()
function with a delay of 100 milliseconds
, I receive the correct value, which is 252px
;
Is there any method to monitor the DOM in order to retrieve the final width value or elements within the template post-rendering? I would prefer not to have to rely on $timeout
to refresh the element in the view.