亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

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
713

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

黃舟
黃舟

人生最曼妙的風(fēng)景,竟是內(nèi)心的淡定與從容!

reply all(1)
左手右手慢動(dòng)作

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.

For the case where the page is very long:

js// PagePosition Service
angular.module('app').factory('PagePosition', function() {
    var _top = 0;
    var _left = 0;

    return {
        getPosition: function() {
            return {
                top: _top,
                left: _left
            }
        },
        setPosition: function(top, left) {
            _top = top;
            _left = left;
        }
    }
});

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template