Scroll up after changing view [closed]

0

I'm using angular on my system

I'm changing views with the command $state.go('main.shops.cart.success');

But problem is that when changes the view scroll continues below. I would like it when it changed view scroll to the top of the page.

How could I do this?

    
asked by anonymous 27.07.2017 / 14:56

1 answer

1

What do you want to do is: window.scrollTo(0, 0) ?

According to this answer: link

I think you can use:

$scope.$on('$locationChangeSuccess', function(event) {
    window.scrollTo(0, 0);
});
    
27.07.2017 / 17:02