Tracking ion-content scroll

Hi, I’m trying to track a page scroll.

I’ve read about 20 threads (lot of them were using the old event listeners) but I can’t find where I’m doing wrong.

I’m using tabs template and in one tab I’ve put this code:

content: Content;
ngAfterViewInit() {
    console.log("After View Init");
    console.log("CONTENT: ", this.content);

    this.content.ionScroll.subscribe(($event) =>  {
        this.scrollAmount = $event.scrollTop;
        console.log("SCROLLING: ", this.scrollAmount);

When open that page it logs “After View Init” and this.content object but when I start scrolling nothing is logged.

I also tried using <ion-content (scroll)="onScroll($event)"> but without results. I think that is related with the <div class="scroll-content"> block that is generated by Ionic.

How can I make it works?

Ionic 2.3.0?



I think the event is ionScroll not scroll, check the API docs


<ion-content (ionScroll)="onScroll($event)">


I checked and it works perfectly with (ionScroll)="onScroll($event)"

Yes, I am on 2.3.0

I tried now downgrading to 2.2.0 and now it works


1 Like

I tried, but it’s a problem with 2.3.0: both (ionScroll) and (scroll) didn’t work.
Now downgrading to 2.2.0 it works with (ionScroll).


1 Like

For the record, the brave @jjosef found a workaround or solution to use ionScroll with 2.3.0, see