Ionic2 InfiniteScroll not working

Ionic scroll does not work when using api…
And $event handler is not fireing

HTML

Ionic Menu Starter


Toggle Menu
    <ion-list [virtualScroll]="items" approxItemHeight="50px">
        <ion-item *virtualItem="let item">
            {{item.name}}
        </ion-item>
    </ion-list>

    <ion-infinite-scroll (infinite)="doInfinite($event)">
        <ion-infinite-scroll-content loadingSpinner="bubbles"
                                     loadingText="Loading more data...">
        </ion-infinite-scroll-content>
    </ion-infinite-scroll>
</ion-content>

Controller
import { Component } from ‘@angular/core’;
import { NavController , Loading} from ‘ionic-angular’;

import {Code4Sa} from '../../providers/code-4-sa/code-4-sa';

@Component({
  templateUrl: 'build/pages/page1/page1.html',
    providers: [Code4Sa]
})
export class Page1 {
    items;
    private start:number=0;

  constructor(private navController: NavController, private code4sa: Code4Sa) {
  }

  ngAfterViewInit() {
     this.updateMedicine();
    } 
    updateMedicine(){
        this.items = [];
        this.code4sa.getAllMedicine().then(data => {
            this.items = data;
           // console.log(data);
        });
    }

    doInfinite(infiniteScroll) {
         console.log('doInfinite, start is currently '+this.start);
        infiniteScroll.complete();
 
      }
}
1 Like

if you are using 2.0.0-beta.8 or above then use (ionInfinite) insted of (infinite)

@piyukore THANK YOU THANK YOU :relaxed:

I got that from V2 Documentation. Where did you find the correct one ?

you are welcome! you can check the documentation for latest version or you can check Changelog

Thanks @piyukore It will be a law for me to read change logs from now on.

Note that the ionic docs are updated on ever commit, so that information was updated when the change was made.

1 Like

I am using ionic 2.2.1 … (ionInfinite ) is not working in my browser ??

Facing same issue in only iphone… browser and android works fine.
having ionic-angular version 2.3.0
changed to ionic-angular 2.0.0
works for me