Home > Mobile >  How to scroll up in angular 2?
How to scroll up in angular 2?

Time:08-26

I have a blog component with a scroll but when I close it and reopen it the scroll is where it was before, I need it to be shown again from above, how can I do it? I am using angular 12

CodePudding user response:

document.getElementById('container-3').scrollTop = 0;

add container-3 in your layout. or you can write in an angular way.

@ViewChild('container') private container: ElementRef;

this.container.nativeElement.scrollTop=0

  • Related