Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable page transition animation in Ionic 4 / Angular?

I’m using ‘routerLink’ to navigate to a new page and I was wondering how I could disable the page transition animation? I couldn’t find an answer to that simple question in the documentation or here (I only found answers to old versions of Ionic / Angular).

Could someone please point me to the right spot?

like image 959
JilReg Avatar asked Jun 16 '19 18:06

JilReg


3 Answers

The parameter has changed from "animate" to "animated".

ie. in app.module.ts, do the following

IonicModule.forRoot({animated: false});
like image 148
below43 Avatar answered Oct 19 '22 07:10

below43


To only disable page transition animations, while leaving the rest of the animations alone, add animated="false" to the <ion-router-outlet>:

<ion-router-outlet id="main-content" animated="false"></ion-router-outlet>
like image 30
Jkc Avatar answered Oct 19 '22 08:10

Jkc


For people who want to control specified page only, you can use NavController of Ionic4 giving { animated: false } as NavigationOptions.

import { NavController } from '@ionic/angular';

constructor(public navCtrl: NavController,) {}

this.navCtrl.navigateForward(path, { animated: false });
like image 32
pipo Avatar answered Oct 19 '22 09:10

pipo