Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70615

How to stop infinite scroll after data finish load

$
0
0

@Mayanktaker wrote:

I want to know how can I stop the infinite scroll after the list finish load the data.
currently when list finished fetching data from serve, it loads the data again. :smiley:
How can I stop loading data after it fetches the all the data ?

html

<ion-refresher (ionRefresh)="doRefresh($event)">
        <ion-refresher-content>
            pullingIcon="arrow-dropdown"
            pullingText="Pull to refresh"
            refreshingSpinner="circles"
            refreshingText="Refreshing...">
        </ion-refresher-content>
      </ion-refresher>
  <ion-list class="animate chat-item">  
          <button ion-item *ngFor="let blood of bloods" (click)="onShowBloodDetail(blood);" class="cardcontent">
        <ion-avatar item-start >
          <img src="{{blood.donor_photo.guid}}" class="imagedonorchota">
        </ion-avatar>
        <h2 style="color:black;  font-size: 22px;"><b>{{blood.donor_name}}</b></h2>
        <p style="color: brown; font-size: 18px;"><b>{{blood.blood_group}}</b></p>
      </button>
  </ion-list>
  <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
      <ion-infinite-scroll-content>
          loadingSpinner="bubbles"
          loadingText="Loading more donors...">
      </ion-infinite-scroll-content>
    </ion-infinite-scroll>

ts

export class BloodmainPage {
  bloods;

  constructor(public navCtrl: NavController, public navParams: NavParams, private BlooddonateProvider: BlooddonateProvider) {
    this.BlooddonateProvider.getBlood().subscribe(data =>{
      console.log(data);
      this.bloods = data;
    });
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad BloodmainPage');
  }

  onShowBloodDetail(blood){
    this.navCtrl.push('BlooddetailsPage', {blood: blood});
  }

  doInfinite(infiniteScroll) {
    this.BlooddonateProvider.getBlood().subscribe(data =>{
      console.log(data);
      this.bloods = this.bloods.concat(data);
      infiniteScroll.complete();
    });

  }

  doRefresh(refresher) {
    this.BlooddonateProvider.getBlood().subscribe(data =>{
      console.log(data);
      this.bloods = data;
      refresher.complete();
    });

  }
}

Please help me… I am new.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>