I’m trying to change my app’s behaviour depending on the Y scroll position. So i have added an ionScroll event listener. But I’ve noticed that the UI does not update straight away.
@ViewChild(Content) content: Content;
....
ngAfterViewInit() {
this.content.enableScrollListener();
this.content.ionScroll.subscribe((scroll: ScrollEvent) => {
this.position = scroll.startY + scroll.deltaY;
console.log("" + this.position);
});
}
If I use this code and scroll, the console updates very rapidly. I get lots of log messages. But if I bind the variable ‘position’ to anything, it only updates once every few seconds.
I tried updating the value in the UI from other sources such as setInterval(…, 100) and the UI updates fast with no problems.
Any theories?