title: Angular 4 get height of element on components parent
body: <p>I have a demo <a href="https://stackblitz.com/edit/angular-8ca9qn?file=app%2Fchild.component.ts" rel="nofollow noreferrer">here</a></p>
  
  <p>I have a super simple parent component with a child component.</p>
  
  <p>How can I get the height of the parent div from the child component.</p>
  
  <pre><code>import { Component, Input, ElementRef, OnInit, ViewChild } from '@angular/core';
  
  @Component({
    selector: 'child-comp',
    templateUrl: './child.component.html'
  })
  
  export class ChildComponent implements OnInit {
  
    @Input() parent: ElementRef;
  
    @ViewChild("self")
    self: ElementRef;
  
    constructor(){
  
    }
  
    ngOnInit(){
      //console.log(this.parent.nativeElement.clientHeight);
      console.log(this.self.nativeElement.offsetTop);
    }
  
  }
  </code></pre>