Any sample code on how to use swipe to go back?


#1

I want to go back to the previous view on swipe left. Documentation has the following but it is not very clear.

button on-swipe-left=“onSwipeLeft()” class=“button”>Test button

Thank you so much for help.


#2

I haven’t looked at it specifically with the 1.0 release client. But if you look at the Ionic Code pens I think someone mentioned that it was in there and you could pick that apart if you haven’t. http://codepen.io/ionic/


#3

Thank you and let me try.


#4

So by default, in RC0, iOS will let you swipe to go back.

Something like this?

http://ionicframework.com/blog/rc0-swipe-to-go-back/


#5

Great! Now it makes sense.


#6

I would add that if users already use the classic on-swipe-left="onSwipeLeft()" calling $ionicHistory.goBack(), they HAVE TO remove it if they use RC0 or RC1. Otherwise the behavior would be altered.


#7

is there also a codpen for sidemenu apps? I updated to rc1, but swipe back didnt work.


#8

Working fine for me.

Do you enable-menu-with-back-views set to true? For swipe to go back to work, this needs to be set to false


#9

yes, it is set enable-menu-with-back-views to false. i tried diffrent thinks but its still not working.
I also implemented playlists.html and playlist.html exactly same way on your example in my app and set window.cordova = { yup: true }; but its not working. I have no more idea :frowning:


#10

Try removing window.cordova = { yup: true };, that was only to get it to work for codepen. If it’s still not working, check to make sure you have the latest release of ionic.


#11

i also tried this. Version is up to date - still no swipe :scream:
when it helps, i can sent you a link to my web app


#12

It is working for me without any issue.


#13

@Patch were you able to figure this out? I have updated both the cli and ionic library to no success. I can’t even seem to get it working on a starter template.


#14

no success with this issue :grin:


#15

@Patch thanks for letting me know. @mhartington any ideas? Again this issue is present even when creating a new project from a starter template.


#16

@Patch so this issue is on a web app and not a compiled app? That would cause your issue. To not interfere with the browsers built in swipe to go back, ours checks to see if you are inside of a cordova web-view. If you’re not inside of corodva, you don’t get the swipe to go back.


#17

Hi @mhartington sir in ionic2 today I start with template sidemenu and side menu is toggle on swiping on screen from every where by mouse. That means when swip from left to right on screen side menu is opening and from right to left sidemenu is close properly.
But when i buid this on my phone ITS NOT WORKING. Today almost all application has this facilities and no one go to top to touch menu button on left-top corrner to open side menu. how can enable this features I also try with making
<ion-nav [root]=“rootPage” #content swipeBackEnabled=“false”>
TO
<ion-nav [root]=“rootPage” #content swipeBackEnabled=“true”>
but does’nt Work

So please consider this issue I am very exited to make app with ionic2
thanx in advance