# How to handle infinite scroll with segments ionic

**URL:** <https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231>\
**Category:** ionic-v3\
**Created:** [May 6, 2017, 11:44pm UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231 "2017-05-06T23:44:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamad](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@Hamad](https://forum.ionicframework.com/u/Hamad)\
**Post date:** [May 6, 2017, 11:44pm UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231/1 "2017-05-06T23:44:47Z")

</div>

how to handle infinite scroll with segments ionic2

---

<div class="post-metadata">

**Author:** ![FrancoisIonic](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/francoisionic/32/106767_2.png) [@FrancoisIonic](https://forum.ionicframework.com/u/FrancoisIonic)\
**Post date:** [May 6, 2017, 11:52pm UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231/2 "2017-05-06T23:52:28Z")

</div>

Segments manage infinite scroll by default, there is nothing specific to do or code.  
However, if you’re planning to load a lot of data in segments, I suggest you to at least use LoadingController. You can also paginate it with custom queries.

But, it is not exactly the best way/component to use it if you have really huge lists of data to load.

---

<div class="post-metadata">

**Author:** ![yasirpanjsheri](https://avatars.discourse-cdn.com/v4/letter/y/c0e974/32.png) [@yasirpanjsheri](https://forum.ionicframework.com/u/yasirpanjsheri)\
**Post date:** [September 10, 2017, 4:57am UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231/3 "2017-09-10T04:57:20Z")

</div>

@FrancoisIonic Hi, I am also having a problem with infiniteScroll and segments… when one of the segments reaching the end , where `infiniteScroll.enable(false)` . Switching to another segment then, the infiniteScroll is not enabled at all… even if I put the boolean value in a variable and initialize it at constructor level.

.ts:

```
 doInfinite(infiniteScroll){
   if (this.segment === 'all'){
     this.doInfiniteForSegmentAll(infiniteScroll);
   } else
   if (this.segment === 'featured'){
     this.doInfiniteForSegmentFeatured(infiniteScroll);
   }
 }

 doInfiniteForSegmentAll(infiniteScroll){
    this.service.getData().subscribe(res => {
       if (res.length > 0){
         //Do stuff
       } else {
         infiniteScroll.enable(false)
         //show a toast
      }
  });
 }

  doInfiniteForSegmentFeatured(infiniteScroll){
     this.service.getData().subscribe(res => {
       if (res.length > 0){
         //Do stuff
       } else {
         infiniteScroll.enable(false)
         //show a toast
      }
    });
  }

```

.html:

```
 <ion-infinite-scroll *ngIf="segment === 'all' || segment === 'featured'" (ionInfinite)="doInfinite($event)" threshold="50px">
    <ion-infinite-scroll-content
      loadingText="Loading" loadingSpinner="dots"></ion-infinite-scroll-content>
 </ion-infinite-scroll>
```

---

<div class="post-metadata">

**Author:** ![FrancoisIonic](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/francoisionic/32/106767_2.png) [@FrancoisIonic](https://forum.ionicframework.com/u/FrancoisIonic)\
**Post date:** [October 9, 2017, 11:50pm UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231/4 "2017-10-09T23:50:21Z")

</div>

@yasirpanjsheri Hi, this is custom code, and it looks really nice coded. However, I fear this can conflict with native code for segments (as for Ionic 2). To help you, I think you should try to inject this as a provider in your project, and give priority to this (I think it’s possible through project files like app.component.ts).

Feel free to answer if that helped you a bit.

---

<div class="post-metadata">

**Author:** ![pgmeteye](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@pgmeteye](https://forum.ionicframework.com/u/pgmeteye)\
**Post date:** [November 4, 2025, 1:13pm UTC](https://forum.ionicframework.com/t/how-to-handle-infinite-scroll-with-segments-ionic/89231/5 "2025-11-04T13:13:00Z")

</div>

I found a way to make this work. Infinite scroll only works inside an `ion-content`, not within segments. To make it work, you need to wrap the content of your `ion-segment-content` inside an `ion-content`.

`<ion-segment-view> `  
` <ion-segment-content>`  
` <ion-content>`  
` <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">`  
` <ion-infinite-scroll-content></ion-infinite-scroll-content>`  
` </ion-infinite-scroll> `  
` </ion-content> `  
` </ion-segment-content>`  
`</ion-segment-view>`
