'Get Height of IonHeader from within Component

Ionic-Angular 5

Using https://github.com/roman-rr/cupertino-pane, I am trying to offset the top by the height of the ion-header i.e. height = 100% - (height of header).

I'm within a child component so I can't ViewChild the header, though I'm not sure that works for ion- elements... Is there a way I can programmatically calculate the height of the ion-header element as it'll obviously vary depending on device?

Thanks,



Solution 1:[1]

In your component :

@ViewChild('header') header: ElementRef


getHeaderHeight(){
  return this.header.nativeElement.offsetHeight;
}

Source : Ionic team

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BorisD