Hi all,
I’m confused by some behaviour I am seeing in my ionic3 app, and wonder if anyone can help me understand what is going on.
The behaviour is:
I am importing ViewChild and Content
import { Component, ViewChild, NgZone } from '@angular/core';
import { NavController, NavParams, Content } from 'ionic-angular';
And then using them in a page:
export class MyPage {
@ViewChild(Content) content: Content;
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public zone: NgZone
) {}
}
Confusingly, what I am seeing is this.content.scrollTop is 0 - unless in the HTML template I bind ionScroll to a function, like this:
<ion-content padding (ionScroll)="scrollHandler($event)">
scrollhandler can be an empty function:
scrollHandler() { /* Don't do anything */ }
If I bind to ionScroll in that way, this.content.scrollTop works as expected.
Does this make sense to anyone? I can’t see anything in the docs about it.