javascript - How to set style in angularjs depending on a different element height after page load? -


i have header element has dynamic height initialized once. want set element, foo, in scrollable view of angular app has height of screen, minus header height. fit onto screen. below element has height 100vh - dynamic size, more elements.

i read 1 can use this:

var myheight = angular.element(document.queryselector('#header'))[0].offsetheight

and use in dynamic inline styling e.g.

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

note: calc css function.

but use it? when app loaded correct height?

try this

$scope.$on('$viewcontentloaded', function(){    //here view content loaded !! }); 

there more ways more info can check this


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -