ui-scroll - cannot come back to the beginning of the list

108 views Asked by At

I just want to scroll downside and after that come back to the beginning of the list.
I know that there are thousands of examples of how to do ui-scroll forth and back but all of them don't seam to work for my solution.

Please help.
The fiddle is added http://jsfiddle.net/4hrjeyqd/3/

 <div ui-scroll-viewport class="testStyle">
   <div ui-scroll="item in datasource" buffer-size='5' adapter="datasource.adapter">
     *one {{item}}*
   </div>
 </div>

JS:

angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
  .factory('datasource', function() {

    var res = {
      data: [],
      adapter: {},
      get: function(index, count, success) {
        console.log('index=' + index + ', count=' + count);

        index--;

        if (index < 0) {
          count += index;
          index = 0;

          if (count < 0) count = 0;
        } else if (index + count >= this.data.length) {
          count = this.data.length - index;
        }

        var dt = this.data.slice(index, index + count);
        success(dt);
      }
    };

    for (var i = 0; i < 100; i++) {
      res.data.push('item ' + i);
    }

    return res;
  });
1

There are 1 answers

0
mirik On BEST ANSWER

As dhilt said, this bug existed in version 1.5.0.
Version 1.4.x and 1.5.1 are working.