The first active controller in my app is ‘AppCtrl’ which checks if the user is already logged in (via localstorage property). If not I’ll call the login view with $state.go('login')
.
Obviously it should not be possible to navigate back with the back button from the login view to the main view. I use the following code in the ‘AppCtrl’:
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true
});
$state.go('login');
Of course $ionicHistory is injected into the controller:
.controller('AppCtrl', function($scope, $state, $http, $ionicHistory) {..}
Unfortunately this is not working, it’s still possible to navigate back to the main view… I tried also $ionicHistory.clearHistory()
, same result…
Any ideas?