10

so i am having hard time to figure out how to scroll page to top of window upon user interaction (like click on item). In AngularJS i could use $window.scrollTo(0, 0); I am not using Angular2 Router so need something like aformentioned $window

Any help would be appreciated.

LithStud
  • 464
  • 2
  • 6
  • 16

1 Answers1

32

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


window.scrollTo(0,0);

Community
  • 1
  • 1
Nikhilesh K V
  • 1,480
  • 13
  • 20