angularjs $window.height is undefined
$window.height is undefined. Where is the problem?
FoodSearchControllers.controller('homeCtrl', ['$scope', '$http', '$window', 'filterArgs', function($scope, $http, $window, filterArgs) {
$scope.popupHeight = $window.height;
console.log($scope.popupHeight);
}]);
Solution 1:
$window
is a wrapper for Window
, and Window
has no height
property . You can use innerHeight
instead, like: $scope.popupHeight = $window.innerHeight;
Solution 2:
You need to include jQuery before angular, it will change the $window
wrapper to the jQuery $(window)
object instead of Window
.