Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic2: How to change the default push animation of Navigation Controller with NavOptions?

I have a list on a view and each item of the list when clicked renders a new view. I want it to be sliding from the right edge of the screen like in default android (I assume). The default NavControl.push() method in Ionic2 renders the new view like it appears out of no where. From the Ionic2 docs, it is mentioned obscurely that, this may be possible (but no examples are given). From the docs regarding NavOptions,

Some methods on NavController allow for customizing the current transition. To do this, we can pass an object with the modified properites.

The property 'animation' understands the following values: md-transition, ios-transition and wp-transition.

Can anyone explain how this NavOptions is used to change the animation of NavController.push()?

like image 318
DroidHeaven Avatar asked Dec 02 '25 09:12

DroidHeaven


1 Answers

Just use :

 var navOptions = {
      animation: 'ios-transition'
 };
 this.navController.push(NewPage, null, navOptions);
like image 158
e666 Avatar answered Dec 04 '25 04:12

e666