Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute Function After Every Digest Loop Before DOM Render

Tags:

angularjs

I would like to execute a piece of code after every $digest loop, after the DOM has been constructed, but before the render. I want this on every $apply, not just the ones after linking/compiling. Where do I add my code?

I am not going to provide my particular use case because I would like to know how to do this in general. If you would like to help me with my particular problem, I have a separate question: Resize IFRAME to Remove Scrollbars

like image 896
John Tseng Avatar asked Jul 26 '13 17:07

John Tseng


1 Answers

you can do $rootScope.$watch(function(){ ... }). The logic in the fn will be called every $digest loop

like image 194
Ian Haggerty Avatar answered Oct 16 '22 00:10

Ian Haggerty