How to get window height in angular js
Main problem: you need to add 'px' units to window.innerHeight
number. And the second one, variable name is iframeHeight
not iFrameHeight
. Fixed expression will look like:
ng-style="{height: iframeHeight + 'px'}"
The window object, although globally available has testability issues as reference in the angular docs https://docs.angularjs.org/api/ng/service/$window .It looks like its not an issue on your code though but for good practice, you can inject a $window service then reference that instead and of course the "px" issue on the bottom.
angular.module('ionicApp', ['ionic']) .controller('MainCtrl', function($scope, $window) { $scope.iframeHeight = $window.innerHeight; });
Later, as said before;
ng-style="{height: iframeHeight + 'px'}"
Since AngularJS contains a small part of jQuery by itself you can use:
// Returns height of browser viewport$scope.iframeHeight = $(window).height();
or
// Returns height of HTML document$scope.iframeHeight = $(document).height();