# Reset ion-infinite-scroll

**URL:** <https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728>\
**Category:** ionic-v1\
**Created:** [August 6, 2016, 4:28pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728 "2016-08-06T16:28:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rasioc](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rasioc](https://forum.ionicframework.com/u/Rasioc)\
**Post date:** [August 6, 2016, 4:28pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/1 "2016-08-06T16:28:44Z")

</div>

Hi,  
is there a way to reset ion-infinite-scroll?  
I’m using a collection-repeat list and have ion-infinite-scroll below it.

```
<ion-infinite-scroll ng-if="hasMore" on-infinite="loadMore()" 
    distance="451px" > </ion-infinite-scroll>

```

My problem:  
I have a checkbox above the list, which shall filter the list (or better: clear the list and start reloading with some filter option)

So when the checkbox is clicked, I’m emptying the list array and set hasMore to true again. However, infinite-scroll is not triggered.

If I do not empty the list, but add some dummy objects (enough that it exceeds the page by a few px) infinite-scroll is triggered correctly, but this is not a solution.

Any idea how to force infinite-scroll to work again?

Thanks!

---

<div class="post-metadata">

**Author:** ![scejas](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@scejas](https://forum.ionicframework.com/u/scejas)\
**Post date:** [August 18, 2016, 2:01pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/2 "2016-08-18T14:01:48Z")

</div>

I have a similar problem. I also have a textbox above the list. When I reach the end of a list, the infinite-scroll not work for the next list of the new search, only showed the first page. If I search before reach the end of current list the infinite-scroll its works well.

it’s posible reset the ion-infinite-scroll??

---

<div class="post-metadata">

**Author:** ![baviskarmitesh](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@baviskarmitesh](https://forum.ionicframework.com/u/baviskarmitesh)\
**Post date:** [August 19, 2016, 9:21am UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/3 "2016-08-19T09:21:54Z")

</div>

use it with DIV as mentioned bellow

\<div infinite-scroll=‘onScrollFunction()’ infinite-scroll-disabled=‘DissableScrollExpression’ infinite-scroll-distance=‘1’\>

\</div\>

---

<div class="post-metadata">

**Author:** ![Rasioc](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rasioc](https://forum.ionicframework.com/u/Rasioc)\
**Post date:** [August 20, 2016, 2:26pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/4 "2016-08-20T14:26:27Z")

</div>

> [@baviskarmitesh](#):
>
> \<div infinite-scroll=‘onScrollFunction()’ infinite-scroll-disabled=‘DissableScrollExpression’ infinite-scroll-distance=‘1’\>
> 
> \</div\>

Exchanged this:

```
<ion-infinite-scroll
    ng-if="hasMore"
    on-infinite="loadMore()"
    distance="451px"
>
</ion-infinite-scroll>

```

with this:

```
<div 
    infinite-scroll="loadMore()" 
    infinite-scroll-disabled="!hasMore" 
    infinite-scroll-distance="451px"></div>

```

but that doesn’t work at all. Not sure how you think this should be working. Talking about ionic 1 here…

---

<div class="post-metadata">

**Author:** ![baviskarmitesh](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@baviskarmitesh](https://forum.ionicframework.com/u/baviskarmitesh)\
**Post date:** [August 22, 2016, 10:13am UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/5 "2016-08-22T10:13:19Z")

</div>

does Your hasMore value properly updated to stop the scroll. I have successfully implemented with this logic. I can can help you if codepen your problem

---

<div class="post-metadata">

**Author:** ![Rasioc](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rasioc](https://forum.ionicframework.com/u/Rasioc)\
**Post date:** [August 29, 2016, 3:47pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/6 "2016-08-29T15:47:32Z")

</div>

I don’t know what Ionic version you are talking about, but my version has following definiton:

```
IonicModule
.directive('ionInfiniteScroll', ['$timeout', function($timeout) {
  return {
    restrict: 'E',
    ....

```

Which restricts the directive to “Tag Name” (`<ion-inifinite-scroll>`). It does not allow attribute name (`<div infinite-scroll="...">`).  
I have no idea why you think this should work.

---

<div class="post-metadata">

**Author:** ![Rasioc](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rasioc](https://forum.ionicframework.com/u/Rasioc)\
**Post date:** [August 29, 2016, 4:53pm UTC](https://forum.ionicframework.com/t/reset-ion-infinite-scroll/59728/7 "2016-08-29T16:53:50Z")

</div>

Seems like I found a solution:

After resetting the data array you can just fire the scroll complete event again, and it will start loading:

```
$scope.reset = function reset() {
   // reset the data model, reset the ng-if condition:
   $scope.upcoming = [];
   $scope.hasMoreUpcoming = true;
   // broadcast complete event, which will trigger reloading:
   $scope.$broadcast('scroll.infiniteScrollComplete');
}
```
