Ionic Back Button going forward


#1

Hi all, I have an issue with the ionic nav back button in of my view.
To explain : On my tab I do a search query to a database. I display results in a view. I can then click on on item to see more detail about it in another view.
Now if I click the back button, I can see the animation is forward (not back) and it brings me to the list result view.
Then If i click back again, i’m bounced back to my detail view, and that’s an infinite loop if I keep hiting the back button.

Here are my controllers :
The controller for the search on my tab :
.controller(‘chercherCtrl’, function ($scope, $state, ResultatRecherche) {
var vignerons = [];
$scope.trouverVigneron = function (datainput) {
$scope.value = datainput;
vignerons = ResultatRecherche.recherche($scope.value.CNtest, $scope.value.textinput);
$state.go(‘tabsController.resultatRecherche’, { vignerons: vignerons });
}
})

Controller that display the results and define function to be called on button click in the display :
.controller(‘resultatRechercheCtrl’, function ($scope, $state, $location, $stateParams) {
$scope.vignerons = $stateParams.vignerons;
$scope.vigneronDetails = function (vigneron) {
$state.go(‘tabsController.vigneronsSearchDetails’, { vigneron: vigneron });
};
$scope.carteVignerons = function (vignerons) {
$state.go(‘tabsController.vigneronsProximit’, { vignerons: vignerons });
};

})

So when I click for details, it calls $scope.vigneronsDetails that trigger this controller :
.controller(‘vigneronsSearchDetailsCtrl’, function ($scope, $state, $cordovaGeolocation, $stateParams) {
$scope.vigneron = $stateParams.vigneron;
})

And from then on the back button in this state will go forward to the list, to enter this loop.

Hope I’m clear enough since i’m new to Angular.
Thx in advance


#2

You tagged the thread with a ionic 2 tag. But it looks like a ionic 1 problem?


#3

oupss. You’re right, changed the tag.
TY for noticing