Angular2 How to scroll to the beginning of the user interaction window

therefore, it’s difficult for me to find a way to scroll to the top of the window when interacting with the user (for example, clicking on an element). In AngularJS, I could use $window.scrollTo(0, 0); I do not use Angular2 Router, so you need something like the above $window

Any help would be greatly appreciated.

+8
angular
source share
1 answer

You can use the javascript window object or refer to this link if you want to do this exclusively in angular 2 ( Angular2 - How to insert a window into an angular2 service ):


window.scrollTo(0,0);

+27
source share

All Articles