Scroll to specific div on (click) in Angular

Discussão em 'Angular' iniciado por Apple Orange, Janeiro 14, 2025.

  1. Apple Orange

    Apple Orange Guest

    I have a #content div and a button component.

    When I click the button, I want to scroll to the top of the #content div.


    HTML:

    <div id="content">
    Loren ipsum
    </div>
    <div (click)="toTop($event)">top</div>


    topscroll.component.ts:

    export class TopscrollComponent implements OnInit {
    constructor() { }

    ngOnInit() { }

    toTop(event){
    ...
    }
    }

    Continue reading...

Compartilhe esta Página