Closed neslinesli93 closed 8 years ago
You can use events to enable/disable transitions when you need.
https://github.com/shprink/ionic-native-transitions#events
https://github.com/shprink/ionic-native-transitions#enabledisable-optional
So the correct way to do this is to listen to ionicNativeTransitions.beforeTransition
, disable the plugin, and then enable it again after the transition happened?
before calling stateGo you can disable the plugin and re enable it right after.
It'd be great if transitions could support state params e.g.
$rootScope.$broadcast('ionicNativeTransitions.beforeBackTransition', toStateTransition, currentStateTransition);
So you could then use:
$rootScope.$on('ionicNativeTransitions.beforeBackTransition', function (event, toState, fromState) {
if (fromState.name === 'submit' && toState.name === 'edit') {
event.preventDefault();
console.log('do something');
}
});
And some way to prevent default on the event to cancel the transition!
@kmturley Brilliant idea. But untill it is implemented we can use $stateChangeStart and $stateChangeSuccess to achieve this functionality if you're using ui-router.
Digging through the code, I found that
$ionicNativeTransitions.stateGo()
will resort to defaultOptions or eventually to slide if no transition object is passed to it. However, it would be very useful to have an option to make it perform no animation when requested. Thanks!