sroze / ngInfiniteScroll

Infinite Scrolling for AngularJS
http://sroze.github.com/ngInfiniteScroll/
MIT License
2.89k stars 724 forks source link

No check for the Integerity of infinite-scroll-distance (Issue with scroll on android devices ). nginfinitescroll version: 1.0.0 #359

Open maximusDreddoff opened 7 years ago

maximusDreddoff commented 7 years ago

I have faced with scroll problems on my android device (xiaomi redmi note 4) when set attr infinite-scroll-distance = '0.5'

I am using angular 1.4.2

And there is no check for Integerity in your library(version 1.0.0):

    scrollDistance = 0;
        if (attrs.infiniteScrollDistance != null) {
          scope.$watch(attrs.infiniteScrollDistance, function(value) {
            return scrollDistance = parseInt(value, 10);
          });

so I had to change it to :


if (attrs.infiniteScrollDistance != null) {
                    scope.$watch(attrs.infiniteScrollDistance, function (value) {
                        return scrollDistance = parseFloat(value);
                    });
                }
graingert commented 7 years ago

@maximusDreddoff ah parseFloat would be way better, can you create a PR?

maximusDreddoff commented 7 years ago

@graingert yep, of course. I will try to create on Monday.