You can use the addScrollEventListener
method of the Scroll component, like so:
this.scroll.addScrollEventListener((event) => {
console.log(event);
});
Your HTML:
<ion-header>
<ion-navbar>
<ion-title>Title</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="no-scroll">
<ion-scroll></ion-scroll>
</ion-content>
Your Typescript:
import {Component, ViewChild} from '@angular/core';
import {Scroll} from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Scroll) scroll: Scroll;
constructor() {}
ngAfterViewInit() {
this.scroll.addScrollEventListener(this.onScroll);
}
onScroll(event) {
console.log(event);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…