I would like to create a "Back to top" button using angualrjs. 

1) Button should be `poisition: fixed; bottom: 0px` when footer is not visible

2) When footer becomes visible, "Back to top" should just sit on top of footer

I tried to create one, but I am having some trouble.

1) when there is less content on the page, button overlaps with footer position is fixed.

2) At times while getting the data from server, if the page is populated using ng-epeat, then the button's position is absolute and i will have to scroll to adjust its position. (i guess this happens coz, for a fraction of second footer is visible, so the position becomes absolute)

Ideally i would like to compute the position of the button after the page loads. how can i do it.

Here is the plunker <http://plnkr.co/edit/IwViMJRnK2aqi8PNqT6n?p=preview>