2016-06-17 23 views
1

我只想向下滾動,然後回到列表的開頭。
我知道有數以千計的如何使用ui的例子 - 向前和向後滾動,但所有這些例子都沒有縫合以解決我的問題。
ui-scroll - 不能回到列表的開頭

請幫忙。
小提琴加入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

由於dhiltsaid,這個bug在1.5.0版本中存在。
版本1.4.x和1.5.1正在工作。