trying to get rid of the back button when going from my log in page to the main view… any idea how I can do that from the controller?
I have tried all the solutions proposed on the forum and some were deprecated and others like $ionicHistory.clearCache(); just won’t work…
How do I get the side menu button appear again? I tried:
$ionicSideMenuDelegate.toggleLeft(true);
but it opens it and that’s not what I want
Also I am not sure why but I lost the back button on all states now…
that’s the one I used to start building the app.
Basically here is what I do:
// Home when logged in
.state('app.home', {
cache: false,
url: "/home",
views: {
'menuContent': {
templateUrl: "templates/home.html",
controller: 'HomeCtrl'
}
}
})
/*
* Home Controller
------------------------------------------------------*/
.controller('HomeCtrl', function($scope, $state, $ionicNavBarDelegate, $ionicSideMenuDelegate) {
// remove back button show the side menu icon after login - Doesn't work how it is supposed to
//$ionicNavBarDelegate.showBackButton(false);
//$ionicSideMenuDelegate.toggleLeft(true);
})
I think what you want to do is set the home state to the root of the navigation stack. This will make it so you can’t go back to the login page but the menu icon will show:
When you go from the login state to the home state it keeps the login as a back view, so even if you disable the back button it won’t show the menu because the back view exists (if you have enable-menu-with-back-views=“false” on your sidemenu). The menu-close directive resets the navigation stack when placed on an item in your sidemenu, so that is all I am doing when going to the home state of my sidemenu. I’m not sure if there is a better way to do this, but it works for me.