I have a scroll listener in my pages component which observes the content scroll event and updates variables on the component.
this.content._scroll.scroll.asObservable().subscribe((event) => {
console.log(event.scrollTop);
var scrollInRem = event.scrollTop / 14;
this.newHeight = this.initialHeight - scrollInRem;
if (this.newHeight <= 8) {
this.newHeight = 8;
}
this.newMargin = this.initialMargin - scrollInRem * 0.4;
if (this.newMargin <= 0.5) {
this.newMargin = 0.5;
}
});
These variables are accessed in the view with:
[ngStyle]="{'margin-top': getMargin()}"
initialMargin: number = 5;
newMargin: number = this.initialMargin;
getMargin = function () {
return this.newMargin + "rem";
}
However recently after updating to RC-4, the new style is not applied to the element all the way through the scroll event, and only applies at the end (or when a new touch or scroll event begins). I know that the observable is getting hit all the time throughout the scroll as the positions are getting logged… anyone know why the view isn’t updating?