When I am using $ionicHistory.backView() it is returning the view that was before the view previous to the current view, so it is going one step back than it should be. But when I refresh the page on the view previous to the current one, where I am testing $ionicHistory.backView() it is returning null. For some reason I am not getting anything for that specific view.
This is my code:
.controller('RegisterController', function($scope, $state, UserService, $auth, MessageService, $ionicHistory) {
$scope.user = UserService.get();
$scope.validate = {};
$scope.registerPromise = {};
console.log($ionicHistory.backView());
And these are the routes:
.state('main.login', {
url: '/login',
views: {
'content': {
templateUrl: 'templates/login.html',
controller: 'AuthController',
}
},
authenticate: false
})
.state('main.login2', {
url: '/login2',
views: {
'content': {
templateUrl: 'templates/login2.html',
controller: 'AuthController',
}
},
authenticate: false
})
.state('register.contact', {
url: '/contact',
views: {
form: {
templateUrl: 'templates/user/register-contact.html',
}
}
})
So, the flow is when the user is on the main.login page, he can either go to the register.contact page where he leaves the contact details, or go to the main.login2 page where he can login or reset the password by going again to register.contact page where he can again send his contact details for reseting the password. That is why I need to know for my form where is the user coming from, since I am using the same form for two things, leaving the contact details for registering and reseting the password. But I am not getting the correct data from $ionicHistory.backView()
