Skip to content

cannot come back to the beginning of the list #109

@mirik123

Description

@mirik123

I just want to scroll downside and after that come back to the beginning of the list.
I know that there are tons of examples of how to do ui-scroll forth and back but all of them don't seem 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>
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;
 });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions