on button click scroll to div angular 7 code example

Example: on button click scroll to div angular

/?css or scss/
html {
  scroll-behavior: smooth;
}

/?typescript/
//use ViewportScroller in angular 
//in constructor
private _vps: ViewportScroller

//function
scrollFn(anchor: string): void{
  	this._vps.scrollToAnchor(anchor)
}

/?HTML/
<button (click)="scrollFn('about')">Scroll to div</button>

///About section
<div id="about">Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio, quasi nostrum labore sequi neque sed nihil consequuntur? Ea, dolorum minima, 
 cumque explicabo dicta est sit harum dolores, assumenda ex non.</div>