How to add location history ?


I have a list page , i don’t want meet cache & scroll position issue , so i use modal to show my detail page.

but every page (include detail page) have a cart button , if click this button will go to cart page .

if i open the modal and go to the cart , i can’t go back .

how to solve this issue ? Is my method correct ?

thank you


Store your scrollPosition in a service and after you go back you can check if there is a scrollposition in your service -> scroll to it.

But keep in mind to reset scrollPosition of the category, if you category changes.

Like in your service:
this.scrollPosition = { categoryId: id, position: xxx};

if you want to handle multiple scroll positions:
this.scrollPositions = { catregoryId: scrollPosition};

So you could scroll to correct position if you already opened the category.


thanks for you solution , cool.

Also i want konw how to cache http , when go back i want use data from cache , and if i use scroll-refresher will call server .
I have no idea how to deal with it.


angularjs has a built-in cache feature for that.
On your service, when you call the server with $http, you can enable cache by doing:



But keep in mind, if you have sensitive data that are changing often use an own caching ;).