1

I have a header element that has a dynamic height that is only initialized once. Now I want to set an element, say foo, in the scrollable view of the angular app that has the height of the screen, MINUS the header height. So they fit perfectly onto the screen. Below the element that has height 100vh - dynamic size, are more elements.

I read one can use something like this:

var myHeight = angular.element(document.querySelector('#header'))[0].offsetHeight

and then say use it in dynamic inline styling e.g.

<foo style="height: calc(100vh - {{myHeight}})">

note: calc is a CSS function.

but where do I use it? when is my app loaded to get the correct height?

The Mechanic
  • 2,301
  • 1
  • 26
  • 37
Toskan
  • 13,911
  • 14
  • 95
  • 185

1 Answers1

1

Try this

$scope.$on('$viewContentLoaded', function(){
   //Here your view content is fully loaded !!
});

there are some more ways for more info you can check this

Community
  • 1
  • 1
The Mechanic
  • 2,301
  • 1
  • 26
  • 37