Answers for "ionic move view to top of page when selected"

0

ionic move view to top of page when selected

<ion-tabs>
  <ion-tab [root]="tab1Root" (click)="myMethod()"></ion-tab>
  <ion-tab [root]="tab2Root" (click)="myMethod2()"></ion-tab>
  <ion-tab [root]="tab3Root" (click)="myMethod3()"></ion-tab>
</ion-tabs>

myMethod()
{
 this.content.scrollToTop();

}
Posted by: Guest on August-06-2020
0

ionic move view to top of page when selected

import { Component, OnInit, ViewChild } from '@angular/core';
import { IonContent } from '@ionic/angular';

@Component({
  selector: 'app-tab2',
  templateUrl: './tab2.page.html',
  styleUrls: ['./tab2.page.scss'],
})
export class Tab2Page implements OnInit {

  @ViewChild(IonContent) private content: IonContent;

  constructor() { }

  ngOnInit() {
  }

  ionViewWillEnter() {
    this.content.scrollToTop();
  }

}
Posted by: Guest on August-06-2020

Code answers related to "ionic move view to top of page when selected"

Browse Popular Code Answers by Language