showing results for - "scrollto angular"
Joseph
06 Jan 2019
1//there are a few options you can go with, the basic one being css only
2//css or scss
3html {
4  scroll-behavior: smooth;
5}
6
7//You could also user ViewportScroller - available in angular 
8//.....
9private _vps: ViewportScroller
10
11scrollFn(anchor: string): void{
12  	this._vps.scrollToAnchor(anchor)
13}
14
15//HTML
16<p on-click="scrollFn('about')">scroll to about sections</p>
17
18///About section
19<div id="about">Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio, quasi nostrum labore sequi neque sed nihil consequuntur? Ea, dolorum minima, 
20 cumque explicabo dicta est sit harum dolores, assumenda ex non.</div>