I've disabled 'swipe back' globally, both in root component and module config
<ion-nav #appNav [root]="rootPage" swipeBackEnabled="false"></ion-nav>
...
IonicModule.forRoot(MobileApplication, {swipeBackEnabled: false}),
...
I need though to enable it for one page only. So'm trying to set it by passing a nav instance to constructor and then setting swipeBackEnabled to true.
ionViewWillEnter() {
this.nav.swipeBackEnabled = true;
console.log('swipeBackEnabled ' + this.nav.swipeBackEnabled);
console.log('canGoBack ' + this.nav.canGoBack());
console.log('canSwipeBack ' + this.nav.canSwipeBack());
}
Logging swipeBackEnabled and canGoBack returns true, but canSwipeBack returns false. If I add a swipe event somewhere in my template and log those values on right swipe, it logs all the values as true. However, nothing happens, seems like swipe back is not working? Am I missing something?
For reference, I'm using Ionic 3.9.2 and @ionic/app-scripts 3.1.4. Thanks in advance
this.nav
? – Duannximport {Nav} from "ionic-angular";
– vitalymnavCtrl
which injected inconstructor
– Duannxnav
is mapped toNavController
. I tested in my project and it worked well. Please reproduce your problem in stackblitz.com for easier debugging – Duannx