Choosing router transition in Angular Ionic 6

Issue

I’m using Ionic 6 with Angular and sometimes Ionic includes some nice animation when transitioning between routes. Can I choose which animation will be used when I navigate using route.navigate(['path'])? Is it possible to choose it from the default Ionic animations?

Solution

Ionic provides default animations for both iOS & Android.

Instead of using route.navigate(['path']), You can use NavController methods. Basically, it uses Angular’s router with explicit direction. Ionic will animate this transition for you.

// imports
import { NavController } from "@ionic/angular";

constructor(
  private navCtrl: NavController,
){ }

// example usage with forward route
this.navCtrl.navigateForward(['path']);

Answered By – Ajan65

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published