0

I've got a ul > li list of items, with a reload button on top. If I hit the reload button, items are added async to the data model. Every time an item is added to the model, it is shown in the view, and the browser scrolls to the top. It's an Cordova app (HTML5). I can of course remember scroll position and scroll back, but that might become visible and is just a hack imo.

How can I make sure the scroll position stays at the same place?

1 Answer 1

1

I think the problem is:

  • You click reload button
  • Your code clears array of items and it triggers angular to rebuild DOM, scroll automatically scroll to top

I suggest the solution, try to use $track by $index in angular ng-repeat https://docs.angularjs.org/api/ng/directive/ngRepeat

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.