angular.js - After viewing the details, the return list page does not stay at the original viewing place - the solution to the angularJS problem? Ask God for advice
黄舟2017-05-15 16:53:07
0
1
636
After viewing the details, the return list page does not stay where it was originally viewed - the solution to the angularJS problem? Ask God for advice
If your list page is a paginated page, then you need to save the page number of the page, maybe in the URL, then when you return, read the page number from the URL and load the data of that page number.
If your list page is a very long page and you need to return to the original position, then you may need to abstract a service to record the user's position on this page, and read this every time you enter this page. service thenscrollTothat location.
If your list page has no pagination and is not very long, it is actually best to just go back to the top of the page.
Inject this service into the view or directive you need, modify the position in the user scroll event, read the position when returning to this page, and call scrollTo to position.
However, I suggest that if the page is too long, it is best to display your list in pages, because even if you can return to the previous position when returning, the user experience is quite poor.
If your list page is a paginated page, then you need to save the page number of the page, maybe in the URL, then when you return, read the page number from the URL and load the data of that page number.
If your list page is a very long page and you need to return to the original position, then you may need to abstract a service to record the user's position on this page, and read this every time you enter this page. service then
scrollTo
that location.If your list page has no pagination and is not very long, it is actually best to just go back to the top of the page.
For the case where the page is very long:
Inject this service into the view or directive you need, modify the position in the user scroll event, read the position when returning to this page, and call
scrollTo
to position.However, I suggest that if the page is too long, it is best to display your list in pages, because even if you can return to the previous position when returning, the user experience is quite poor.