angularjs - Why can't I set the height of an element with ng-style? -


i trying add dynamically set height of div, not being set. height of window , divide 3, not working. here set height:

<div id="wrapper" ng-style="height :hgt+'px'"> 

i setting scope variable this:

 $scope.hgt = $window.innerheight / 3; 

but height isn't set.

plunker http://plnkr.co/edit/egapwudpgknwdnozmjwu?p=preview

the usage of ng-style counter-intuitive. you're attempting use interpolate values, per angular documentation ng-style takes expression "which evals object keys css style names , values corresponding values css keys."

thus, might want try:

$scope.hgt = { height: ($window.innerheight / 3) + 'px' }; <div id="wrapper" ng-style="hgt"> 

hope helps!


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -