R
R
Rodion Meshcheryakov2014-08-08 14:30:23
Angular
Rodion Meshcheryakov, 2014-08-08 14:30:23

How to store page state in Angular SPA?

As far as I understand, there can only be one ng-view container per page, which will load the content of the pages. Accordingly, the newly loaded page will overwrite the current one.
Let's say there is some filterable data on the SPA page. The user filtered the data, got a selection, and went to the page of a specific element from the selection. Returning back, he expects to see the same selection, but instead he will see the original state of the data, because updated by the controller.
What is the best way to save the state of the page with the received selection? This applies not only to data samples, but also to other situations in which you need to store state.
UPD1: Example. This is an example app from the Angular Tutorial. If you enter 'axis' in the input field, then only one phone will remain in the list. If you go to the page of this phone, and then go back to the list, the list will return to its original state.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TekVanDo, 2014-08-08
@rodionme

Use https://github.com/angular-ui/ui-router there and multiple views are supported and state can be saved.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question