Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

How to get ion-header height in Angular (the right way)?

$
0
0

@Arkthur wrote:

In my app I need to get the height of an ion-header element. I’ve tried with:

<!-- TEMPLATE -->
<ion-header #header>
  <!-- ... -->
<ion-header>
<!-- ... -->
// COMPONENT
ViewChild('header') header: IonHeader;
// ...
getHeaderHeight() {
  return this.header.el.offsetHeight;
}

This only works if header's type is any. If it is IonHeader it throws this error:

Property 'el' is protected and only accessible within class 'IonHeader' and its subclasses.

The error is pretty clear. What bugs me is the fact that there should be a non-hacky way to do this. Using any just feels like cheating.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>