@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 isany
. If it isIonHeader
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