Smooth scroll angular2

there is a method in the window object called scrollTo().
If you set the behavior to ‘smooth’ the page will handle the smooth scroll.
example (scroll to top of page):

 window.scrollTo({ left: 0, top: 0, behavior: 'smooth' });

And with fallback example:

    try 
    { 
     window.scrollTo({ left: 0, top: 0, behavior: 'smooth' });
     } catch (e) {
      window.scrollTo(0, 0);
      }

Leave a Comment