Swipe back not working


#1

Hello,

I have a problem with the Swipe to go Back feature.
When I move to a View I’m not able to go back with swiping.

Testing on iOS Device with Ionic View
sidemenu allows swipe to go back on Ionic View

My index.html

<body ng-app="starter">
	<ion-nav-bar class="bar-positive">
		<ion-nav-back-button>
 			 </ion-nav-back-button>
	</ion-nav-bar>

	<ion-nav-view name="layout"></ion-nav-view>
</body>

My App route

$stateProvider
	.state('main#index', {
		url: "/main-index",
		views: {
			'layout': {
				templateUrl: "modules/main/views/index.html",
				controller: "main_index",
			}
		},
	})

            /* etc ... same way */

$urlRouterProvider.otherwise("/main-index");		

The index.html of module main

<ion-view view-title="Title">
    <ion-content>
           <some element ng-click="goto($index)">
    </ion-content>
</ion-view>

Controller:
$scope.goto = function(index) {
	$state.transitionTo("main#details", {
		obj: JSON.stringify($scope.items[index])
	});
};

How can I make it work or what I’m doing wrong?


#2

!! SOLVED !!

How?
Change your body-tag of your index.html so that it is equal to the following code

<ion-nav-view></ion-nav-view>

Create an HTML file for your layout like in sidemenu App
The whole code could be

<ion-nav-bar class="bar-positive">
	<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-view name="layout"></ion-nav-view>

Use the same $stateProvider structure from the sidemenu app.

$stateProvider
	.state('app', {
		url: '/app',
		abstract: true,
		templateUrl: "path/to/your/template.html"
	})

Done.
Work’s perfect but the animation / transition is a bit to hard.


#3

It is not working for me. I creaetd the plunker page. Any help would be great


#4

Hi,

Any update on this - I am unable to use this feature.