Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this with ng-repeat #15

Open
itay-initech opened this issue Oct 28, 2013 · 7 comments
Open

How to use this with ng-repeat #15

itay-initech opened this issue Oct 28, 2013 · 7 comments

Comments

@itay-initech
Copy link

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

@rvaitkus
Copy link

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

@ghost
Copy link

ghost commented Nov 19, 2013

Same thing here!

@itay-initech
Copy link
Author

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);
}

@neoswf
Copy link

neoswf commented Apr 3, 2014

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.

@Elijen
Copy link

Elijen commented Apr 24, 2014

@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?

@adrianenriquez
Copy link

Same here!

@tjwoon
Copy link

tjwoon commented Jan 13, 2015

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];
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants