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

content.scrollTop is 0 unless I bind to (ionScroll)

$
0
0

@wvoelcker wrote:

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.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70757

Trending Articles



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