Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ion-content method scrollToPoint not working on Ionic 5

I am following this ionic5 and github documentation in order to programmatically scroll my page to a point. Following is the code

getContent() {
      return document.querySelector('ion-content');
}

scrollPage() {
      this.getContent().scrollToPoint(100,100);
}

Method scrollToPoint() is not doing anything. Is there another way of calling this method?

like image 378
Tapas Mukherjee Avatar asked Dec 08 '25 08:12

Tapas Mukherjee


1 Answers

You can not apply methods at item obtained by selector. You must be select this ion-content with @ViewChild and can use methods:

@ViewChild(IonContent) content: IonContent;

content.scrollToPoint(100,100);

like image 196
JesusDev1994 Avatar answered Dec 10 '25 13:12

JesusDev1994



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!