ng-iScroll
ng-iScroll copied to clipboard
How to use this with ng-repeat
I'm trying to implement this plugin on ng-repeat list but it doesn't work please help
For me the same. When I try to scroll it goes back to the start position
Same thing here!
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); }
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 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?
Same here!
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];
}
}