Navigation goes back two views

Hi all,

I’m pretty new with Ionic and I suppose this problem has an easy solution but nevertheless one that I’m really struggling finding out!

I’m designing a Ionic App and what happens is that in the browser the navigation works nice: on the second level view the back button drives correctly on the previous view, on the device (or emulators) instead it jumps a view and goes back to the first one.

These are the routes:

I use ng-click to call controller functions where I change state with “$state.go”. Everything works well except for this awkward behavior on the devices and emulators.

The strange behavior happens when clicking the back button on the navbar when coming back from state “post” to state" diario"

.config(function($stateProvider, $urlRouterProvider, $mdIconProvider) {

// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state’s controller can be found in controllers.js
$stateProvider

.state('home', {
url: '/home',
templateUrl: 'views/home/home.html',
controller: 'home'

})

.state(‘login’, {
url: ‘/login’,
templateUrl: ‘views/login/login.html’,
controller: ‘loginCtrl’
})

.state(‘diario’, {
url: ‘/diario’,
templateUrl: ‘views/diario/diario.html’,
controller: ‘diarioCtrl’
})

.state(‘post’, {
url: ‘/post/:selectedpost’,
templateUrl: ‘views/dettaglio_post/dettaglio_post.html’,
controller: ‘dettaglio_postCtrl’
});

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise(’/home’);

})

Thanks everybody

Ciao!
Adriano