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.
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
Post a Comment