即使在向上滚动时,AngularJS无限滚动调用也会起作用
I am using infinite scroll from http://binarymuse.github.io/ngInfiniteScroll v1.1.0. I have a table whose contents will be loaded dynamically as the user scrolls down.
我在http://binarymuse.github.io/ngInfiniteScroll v1.1.0中使用无限滚动。我有一个表,其内容将在用户向下滚动时动态加载。
I did the same thing in this plunk which pushes data inside the array which is displayed inside a div and it works fine as expected.
我在这个plunk中做了同样的事情,它将数据推送到div中显示的数组内,并且按预期工作正常。
When I tried to do the same on other page, showMore() function is called not only on scrolling down but also when scrolling up. Here the structure of the table.
当我尝试在其他页面上执行相同操作时,showMore()函数不仅在向下滚动时被调用,而且在向上滚动时也被调用。这里是表的结构。
<table>
<thead>
<tr>
<th>Some heading</th>
<th>Some other heading</th>
</tr>
</thead>
<tbody>
<div infinite-scroll="showMore()" infinite-scroll-distance="3" infinite-scroll-disabled='infiniteScrollDisabled'>
<tr ng-repeat="r in report">
<td>{{$index}}</td>
<td">{{r.someData}}</td>
</tr>
</div>
</tbody>
</table>
I dont understand why showMore()
function is called even on scrolling up. Has it anything to do with the table structure ?
我不明白为什么showMore()函数甚至在向上滚动时被调用。它与表结构有什么关系吗?
2 个解决方案
#1
2
The solution is to move <div infinite-scroll="showMore()" infinite-scroll-distance="3" infinite-scroll-disabled='infiniteScrollDisabled'>
解决方案是移动
更多相关文章
- jQuery:执行一个函数AFTER toggleClass被执行
- 等待执行所有ajax回调的最佳解决方案
- 使用Sinon模拟require()函数
- 如何使函数等到对象的值未定义为js setTimeout
- 放在和中的javascript语句,但是语句不在函数中,这些语句何在被执行
- [JavaScript]自执行函数
- 父范围中的变量不会在匿名函数中被更改[重复]
- 如何调用另一个函数内的函数?
- res.jwt不是函数 - NodeJS Express