ng-iScroll icon indicating copy to clipboard operation
ng-iScroll copied to clipboard

How to use this with ng-repeat

Open itay-initech opened this issue 11 years ago • 7 comments

I'm trying to implement this plugin on ng-repeat list but it doesn't work please help

itay-initech avatar Oct 28 '13 13:10 itay-initech

For me the same. When I try to scroll it goes back to the start position

rvaitkus avatar Oct 30 '13 11:10 rvaitkus

Same thing here!

ghost avatar Nov 19 '13 15:11 ghost

maybe it'll work by calling the refresh method after the ng-repeat finished to render the last item. in your item directive:

if (scope.$last){ setTimeout(function(){ scope.refreshiScroll(); },0); }

itay-initech avatar Nov 19 '13 16:11 itay-initech

refreshiScroll() will only work if its configured in your scope.

What it actually does is

$scope.$parent.myScroll['scroller'].refresh(); 

I refer to scroller, since referring to wrapper its an error in the code example.

neoswf avatar Apr 03 '14 20:04 neoswf

@NeoSwf myScroll['scroller'] is undefined and myScroll['wrapper']['scroller'] has no refresh method.

The $scope.$parent.myScroll['wrapper'].refresh(); from demo example does not work for me.

Did anybody of you guys actually made this work?

Elijen avatar Apr 24 '14 11:04 Elijen

Same here!

adrianenriquez avatar May 05 '14 09:05 adrianenriquez

I have solved this for my own project. For me the problem was incorrect retrieval of myScrollOptions performed by this library. Fix is below (based on branch 1.2b):

At line 64 of ng-iscroll.js, change this:

        if (scope.$parent.myScrollOptions) {
            for (var i in scope.$parent.myScrollOptions) {
                if (i === scroll_key) {
                    for (var k in scope.$parent.myScrollOptions[i]) {
                        ngiScroll_opts[k] = scope.$parent.myScrollOptions[i][k];
                    }
                } else {
                    ngiScroll_opts[i] = scope.$root.myScrollOptions[i];
                }
            }
        }

To this:

        if (scope.$parent.myScrollOptions && scope.$parent.myScrollOptions[scroll_key]) {
            for (var k in scope.$parent.myScrollOptions[scroll_key]) {
                ngiScroll_opts[k] = scope.$parent.myScrollOptions[scroll_key][k];
            }
        }

tjwoon avatar Jan 13 '15 17:01 tjwoon