You're missing 'px' in the ng-style
See Plunker: http://plnkr.co/edit/eqKz9wgyzm8LOz6pZAN0?p=preview
To answer your question, no... any variable you wish to use in HTML must be a scope variable.
If the window height is changing, then you can use a watcher to bind the variable to the window height:
$scope.$watch(function(){
return $window.innerHeight; // the thing to watch
}, function(newValue, oldValue) { // the function to run when the value changes
console.log(newValue);
$scope.divnHeight = $window.innerHeight;
});
Update:
try adding this into your controller, this just registers a function to fire when you resize:
window.onresize = function(event) {
console.log("Fire resize");
$scope.divnHeight = $window.innerHeight;
};
Also, the size may stay the same because you are using max-height rather than height, in which case the height depends on the content, try using height and see if that makes a difference:
<div ng-style="{'height': divHeight + 'px'}" style="overflow-y: auto">