Scroll always on top in AngularJS Scroll always on top in AngularJS angularjs angularjs

Scroll always on top in AngularJS


As per the ngView documentation you need to declare how you want scrolling to be handled.

autoscroll (optional) string Whether ngView should call $anchorScroll to scroll the viewport after the view is updated.

  • If the attribute is not set, disable scrolling.
  • If the attribute is set without value, enable scrolling.
  • Otherwise enable scrolling only if the autoscroll attribute value evaluated as an expression yields a truthy value.

It is disabled by default so you will need to add the following to your markup:

<div ng-view autoscroll></div>

or (as per the docs and depending on your preference):

<div ng-view autoscroll="true"></div>


I'm not the best with angular js, but I got a similar problem and I fixed it using the following code:

<div data-ng-view data-autoscroll="true"></div>

you can take a look the documentation here: angular doc

I hope it's helps