Open page already scrolled at bottom (chat app)

Try this.

<ion-content>
  <ion-list>
    <ion-item *ngFor="let item of items; let last = last">
      {{item}}
      {{last ? callFunction() : ''}}
    </ion-item>
  </ion-list>
</ion-content>
export class Page2 {
  public items: any[] = [];
  @ViewChild(Content) content: Content
  constructor(
    public navCtrl: NavController,
    public navParams: NavParams) {
    setTimeout(() => {
      for (let i = 0; i < 100; i++) {
        this.items[i] = i
      }
    }, 300)
  }
  callFunction(){
    this.content.scrollToBottom(0)
  }
}

20 Likes