dynamically menu smooth scroll to specific Id on click in angular 14

Viewed 33

I am using angular 14, We want to scroll the menu in the one-page application by its id. and how to get the ID from another component in the ts file.

header.component.html

<li class="nav-item active " (click)="scolluser()"  *ngFor="let users of user">

header.component.ts

  scolluser() {
    this.scroller.scrollToAnchor("service");  // get id dynamically from another components 

  }
0 Answers
Related