0

I'm trying to make pagination in angularjs. I'm using for frontend angularjs, and I get data trough http request from app made in codeigniter php. Every tutorial or script I did found for angular pagination lose page number after page refreshed. Also if you go on some another page and back pagination will start again from first page. How can I solve this problem, what is the best solution? Do I need remember page number in session, or calculate on backend which records I will return?

Any idea?

1 Answer 1

1

It is important to remember that AngularJS is a JavaScript framework. JavaScript simply stores its values in temporary memory, so if the page is refreshed, all of the JavaScript variables and values are lost.

If you want your data to persist beyond a page refresh then you need to store that data somewhere. The typical options are in cookies, session storage or local storage. These are features that web browsers have for the purpose of persisting data.

In your case, it sounds like you would want to store some information in session storage, so that after refreshing the page, your application can "remember" where it was in the data.

Take a look at ngStorage.

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.