반응형
angularjs $140.높이가 정의되지 않았습니다.
$140입니다.높이가 정의되지 않았습니다.어디가 문제입니까?
FoodSearchControllers.controller('homeCtrl', ['$scope', '$http', '$window', 'filterArgs', function($scope, $http, $window, filterArgs) {
$scope.popupHeight = $window.height;
console.log($scope.popupHeight);
}]);
$window 는 의 래퍼입니다.Window없다height소유물.사용할 수 있습니다.innerHeight대신 다음과 같이 합니다.$scope.popupHeight = $window.innerHeight;
angular 앞에 jQuery를 포함해야 합니다. 그러면 angular가$windowjQuery까지 포장하다$(window)오브젝트를 지정합니다.
당신은 그것을 얻을 수 있다jquery사용 요소var page = angular.element($window);그럼 키를 잡으세요.page.height();
이걸 써보세요.시간 창에 높이가 인식되지 않을 수 있습니다.
$scope.calculateScreenHeight = function() {
var height = $window.innerHeight;
var width = $window.innerWidth;
}
언급URL : https://stackoverflow.com/questions/20440749/angularjs-window-height-is-undefined
반응형
'programing' 카테고리의 다른 글
| Rspec 테스트를 사용하여 rails json API 예제를 완료합니다. (0) | 2023.03.21 |
|---|---|
| 스프링 MVC에서 JSON payload를 @RequestParam에 POST하는 방법 (0) | 2023.03.21 |
| use Callback, use Memo 및 use Effect를 사용하는 경우 (0) | 2023.03.21 |
| 일치하는 항목이 없을 때 JPA 쿼리 값 반환 (0) | 2023.03.21 |
| [ Validate ]옵션 버튼의 각도 확인JS (0) | 2023.03.21 |