Getting element height
The correct way is to use @ViewChild() decorator: https://angular.io/docs/ts/latest/api/core/index/ViewChild-decorator.html Template: <div class=”view-main-screen” #mainScreen></div> Component: import { ElementRef, ViewChild } from ‘@angular/core’; export class viewApp{ @ViewChild(‘mainScreen’) elementView: ElementRef; viewHeight: number; constructor() { } clickMe(){ this.viewHeight = this.elementView.nativeElement.offsetHeight; } } That should do it but obviously you need to add your Component decorator. Edit: For Angular 8 … Read more