Execute a function after each digest cycle before the DOM Render

I would like to execute a piece of code after each $ digest cycle after creating the DOM, but before rendering. I want this on all $ apply, not just after the link / compilation. Where can I add the code?

I am not going to provide my specific use case because I would like to know how to do it in general. If you want to help me with my specific problem, I have a separate question: Resize IFRAME to remove scrollbars

+6
source share
1 answer

you can do $rootScope.$watch(function(){ ... }) . We will call logic in fn each cycle $digest

+16
source

Source: https://habr.com/ru/post/950381/


All Articles