Jonathan Hutchinson
Jonathan Hutchinson

Reputation: 159

Get Document Height in Angular 2

I need to convert some jQuery code to Angular 2 and am having some trouble figuring out how to get the height of the document.

The jQuery code I have used is

$(document).height();

How would I achieve this in Angular 2?

Thanks

Upvotes: 3

Views: 9344

Answers (2)

kind user
kind user

Reputation: 41893

Using document.height doesn't work in angular 2 aswell as in the console.

console.log(window.outerHeight);
console.log(window.innerHeight);
console.log(screen.height);

Upvotes: 4

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657158

What about just using document.height without jQuery?

document.height

https://developer.mozilla.org/en-US/docs/Web/API/Document/height

This worked in the Plunker

document.documentElement.clientHeight

Plunker example

Upvotes: 1

Related Questions