Automatically (recommended)
ng add ngx-scrolltop
In app.component.html you just need to add your new button. Usually at the end of file:
<ngx-scrolltop></ngx-scrolltop>
For other options check this out:
ngx-scrolltop - npm (npmjs.com)
Advanced example:
<ngx-scrolltop
[size]="50"
backgroundColor="#33691e"
symbolColor="#fff"
symbol="↑"
mode="smart"
position="left"
theme="pink"
>
</ngx-scrolltop>