I'm very new to angular and I'm only starting to understand how everything works. I have a button that the user clicks, changes some stuff in the page and in mobile I need it to scroll to top so the user can see what has been changed. All works except the scrolling part. This is what I have:
The link that gets clicked:
<div (click)="selectColorElement(item)"> {{item.title}}</div>
The function it calls inside the component:
selectColorElement(selectedColor: AmbientItem){
/*Unrelated stuff that changes things in the page, I tried commenting all this and no changes*/
window.scrollTo(0,0);
}
I read this question Angular2 How to scroll to top of window on user interaction but apparently it does nothing for me in this case.