In Ionic V3.X, this would scroll view to top:
@ViewChild(Content) content: Content;
this.content.scrollToTop();
In Ionic V4, this no longer works - 'Property scrollToTop does not exist on type Content'.
Is there an alternative? Thanks.
Use
@ViewChild(IonContent) content: IonContent;
...
this.content.scrollToTop(500);
It works for me, hope it will help you too. For more details https://www.freakyjolly.com/ionic-4-how-to-scroll-to-top-bottom-using-ion-content-scroll-events/
Seems like the scrollToTop()
method was added in v4.0.0-beta.3 but some issues were fixed a few hours ago in v4.0.0-beta.6, so please update Ionic to the beta.6 version and the scrollToTop()
method should be available there.
EDIT:
Thanks, but I'm already on V4.0.0-beta.6. Checking API, clearly there is no scrollToTop() anymore.
I'm sorry to insist, but I've just installed V4.0.0-beta.6 and I'm able to use the scrollToTop()
method without any problems:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With