I am working on a workaround using position: absolute that needs the position of a div to be calculated.
<html>
<!-- this iframe will positioned by an angular partial through a directive -->
<iframe style="position: absolute; width: 400px; height: 400px";></iframe>
<div id="angular"></div>
<html>
It works fine for static partials like this:
<div id="dummy" style="width: 400px; height: 400px;"></div>
<reposition></reposition>
but for dynamic partials that have ng-if or ng-show it won't work because the calculated positions will change after rendering.
<div ng-if="variable" style="width: 200px; height: 200px"></div>
<div id="dummy" style="width: 400px; height: 400px;"></div>
<reposition></reposition>
If I can intercept ng-if and ng-show to do the following: ng-if, code to reposition then I can make it work. I was thinking about writing a new directive say ng-hack-if that would do the same.
Here is the codepen. Just toggle the directive's ng-show from true to false. When it is true everything works, reposition works fine. But when it is false, reposition thinks there is a div but Angular removes it in its the evaluation cycle. I simply need to call the moveContainerAccordingToHolder when AngularJS does a DOM modification i.e calls ng-show in this case.