viewportscroller.scrolltoanchor smooth code example
Example: smooth scroll in viewportscroller
//HTML
<button (click)="scrollToElement(target)"></button>
<div id="target" #target>Your target</div>
//Ts code :
scrollToElement($element): void {
console.log($element);
$element.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
}