Ion-scroll and on-scroll event

Hi there,
I am trying to get the on-scroll event with ion-scroll (with ionic 0.9.27):

<div class="photos"> <!-- has "controller: PhotosCtrl as photosctrl" in state definition -->

  <ion-content class="thumbscontainer" scroll="false">
    <div class="row">
      <div class="col col-bottom">
        <ion-scroll direction="x" class="thumbsscroller" on-scroll="photosctrl.checkImages()">
          <div class="thumbs" ng-repeat="thumb in thumbs" item="thumb">
            <img class="thumb" lazy-src="{{thumb}}" ng-click="photosctrl.selectImage(thumb)"/>
          </div>
        </ion-scroll>
      </div>
    </div>
  </ion-content>
</div>

While the scrolling actually works as expected, the on-scroll event does not fire (The source code says

/**
 * @ngdoc directive
 * @name ionScroll
 ...
 * @param {expression=} on-scroll Called whenever the user scrolls.
 ...

)

The only way I found is a bad hack:

<ion-scroll direction="x" class="thumbsscroller" onscroll="window.checkImages()">

using onscroll instead on-scroll with checkImages added to global window object as function.

How do I get on-scroll working?

Thanks
Bernhard

It doesn’t actually seem to be implemented in the source code.

Here is my sample: http://codepen.io/calendee/pen/ejzAc

The source code never uses the onScroll attribute; so, I don’t think it will ever get called.

I’ve opened Issue # 865 : https://github.com/driftyco/ionic/issues/865

Thanks!
So I will stick with my hack for the time being.

Bernhard

Wow. Andy is fast. He already fixed it. However, it’s only available in the nightlies.

1 Like

Cool, thanks!
The change was small, so I could quickly add it locally into my ionic.bundle.js … and it works as expected.

Bernhard