How can I achieve a scroll downwards and then return to the beginning of the list?
I've searched for examples on how to implement ui-scroll back and forth, but none seem to fit my needs.
Please assist.
You can find the fiddle here: 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;
});