Skip to content

ion-infinite-scroll not working #661

Closed

Description

@ballmw

The ion-infinite-scroll is not functioning, it is always present and does not show or hide with an active class.

Activity

  1. ballmw commented on Feb 21, 2014

    @ballmw
    Author

    It looks like the ion-content directive tries to get an element called 'infinite-scroll' which has been renamed to 'ion-infinite-scroll'.

    Similarly the scss doesn't have the correct element in it.

  2. deflomu commented on Feb 25, 2014

    @deflomu

    Pull request here: #674

  3. adamdbradley commented on Feb 25, 2014

    @adamdbradley
    Contributor

    Thanks for the PR @elm!

  4. self-assigned this
    on Feb 25, 2014
  5. added this to the 0.9.26 milestone on Feb 25, 2014
  6. deflomu commented on Feb 26, 2014

    @deflomu

    Infinite scrolling is still not working. See http://codepen.io/elm/pen/Becqp for nightly version. loadMore() is only called once. Also the passing of the cb() function to the loadMore() function (in the ionContent directive) is not working.

    Also see the test js/ext/angular/test/list-fit.html

  7. ajoslin commented on Feb 26, 2014

    @ajoslin
    Contributor

    Sorry about the regressions!

    I think while we're here though, we need to change the API for this while we're still in alpha - it doesn't match how pull to refresh works.

    How about <ion-content on-infinite-scroll="doSomething()"> - and $scope.doSomething will $broadcast 'scroll.infiniteScrollComplete' when it finishes whatever action it does.

    And of course it would need to be documented! We are working on this as well :-)

    Thoughts?

  8. deflomu commented on Feb 26, 2014

    @deflomu

    That sounds good. Seems to be consistent with pull to refresh and that's how I would expect it to work.

  9. ajoslin commented on Feb 26, 2014

    @ajoslin
    Contributor

    OK, let's wait for @adamdbradley to chime in.

  10. adamdbradley commented on Feb 26, 2014

    @adamdbradley
    Contributor

    Consistency 👍

  11. 19 remaining items

  12. ballmw commented on Mar 4, 2014

    @ballmw
    Author

    No, thank you for all the effort!

    On Mon, Mar 3, 2014 at 10:05 PM, Andy Joslin notifications@github.comwrote:

    Thanks for all the investigation guys, I'll get this down and working asap
    tomorrow. Sounds like some inadequate api changes, sorry about the troubles
    :-)
    On Mar 3, 2014 7:45 PM, "Michael Ball" notifications@github.com wrote:

    I agree with elm:

    In the prior code changes, within the ionContent directive the infinite
    scroll code is set up like so:

    $element.bind('scroll', function(e) {
    if( scrollView && !infiniteStarted && (scrollView.getValues().top >
    maxScroll() ) ) {
    infiniteStarted = true;
    infiniteScroll.addClass('active');
    var cb = function() {
    scrollView.resize();
    infiniteStarted = false;
    infiniteScroll.removeClass('active');
    };
    $scope.$apply(angular.bind($scope, $scope.onInfiniteScroll, cb));
    }
    });

    on angular.bind the 3rd param is the callback. That is passed to my
    "loadMore" method. I am currently responsible for calling that function:

    cb();

    If I call that function the scroll will continue to try to load more as
    scrolling continues.

    If I DO NOT call that function the infinite scroll will attempt to load
    no
    more.

    This is all well and good, but not documented, the ionContent docs say
    the
    ion-infinite-scroll should be a function, ie "loadMore()" but they need
    to
    be a reference to a function, ie "loadMore".

    So we need another way to tell the scroller we're at the bottom, there is
    no more.

    Reply to this email directly or view it on GitHub<
    https://github.com/driftyco/ionic/issues/661#issuecomment-36586762>

    .

    Reply to this email directly or view it on GitHubhttps://github.com//issues/661#issuecomment-36587719
    .

  13. ajoslin commented on Mar 4, 2014

    @ajoslin
    Contributor

    Hey @ballmw,

    So the current version of the docs are actually correct. Although we will be changing things a bit (#720) in beta 1 to make more sense.

    Remember the power of angular: simply use an ng-if on your infinite scroller if you wish to load no more. I think this is a great solution because it uses the power of angular without the framework having to do more.

    function MyCtrl($scope) {
      $scope.loadMore = function() {
        $scope.noMoreScroll = true;
      };
    }
    <ion-content on-infinite-scroll="loadMore()">
      <ion-infinite-scroll ng-if="!noMoreScroll"></ion-infinite-scroll>
    </ion-content>
  14. ballmw commented on Mar 4, 2014

    @ballmw
    Author

    That'll work great, thanks.

  15. adaptivedev commented on Dec 31, 2014

    @adaptivedev

    I'm still having problems where loadMore() won't be called even though I call

    $scope.$broadcast('addGoals.infiniteScrollComplete');

    after I receive items, and there is more room on screen and I've set

    <ion-infinite-scroll on-infinite="loadMore()" distance="1%">

    I've tried with distance 50%, 1000px, etx, with/out ng-if, etc

    Sometimes the ion-infinite-scroll works, but if I rearrange some code, it suddenly doesn't, and there's no indication why.

  16. adaptivedev commented on Jan 8, 2015

    @adaptivedev

    Does it matter from where I broadcast this? Ie, in an indirect callback passed to a function partial, etc?

    $scope.$broadcast('scroll.infiniteScrollComplete');

  17. chrisbenseler commented on Jun 24, 2015

    @chrisbenseler

    Same with me @adaptivedev

  18. robksawyer commented on Nov 6, 2015

    @robksawyer

    I'm still having issues with infinite scroll. I've implemented what's outlined in the docs, but it's not working as expected. The issue that I'm experiencing is outlined at ion-infinite-scroll keep on calling the method of on-infinite. Anyone, have an example of how it should be implemented?

  19. CarlLee commented on Dec 11, 2015

    @CarlLee

    I want to report that if there're more than one <ion-content> in the page, only one will work. Because require in the directive definition will only return the last <ion-content>

  20. abdulhafeez commented on Feb 6, 2016

    @abdulhafeez

    I am facing same issue as @adaptivedev
    loadMore is never called.

  21. babinc commented on Jun 30, 2016

    @babinc

    I too am having issues with ion-infinite-scroll

  22. Focushift commented on Aug 18, 2016

    @Focushift

    @CarlLee thanks for possible explanation why it isn't working, looks like its time to reinvent this directive for complex apps.

  23. jayzyaj commented on Jul 24, 2018

    @jayzyaj

    I am facing an issue where the ioninfinite event is only called once. So I needed to go to the top of the content and scroll again down to call the event again. Any solutions?

  24. ionitron-bot commented on Sep 1, 2018

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  25. locked and limited conversation to collaborators on Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions