Hi, I’m an Ionic/Angular newbie at this point, apologies if this is an obvious answer.
I have the following code in my side menu controller which loads an action sheet when one of the menu buttons is clicked:
.controller('MenuCtrl', function($scope, $location, $ionicActionSheet, $ionicSideMenuDelegate) {
$scope.showActions = function() {
$ionicActionSheet.show({
buttons: [
{ text: 'Contact Support' },
{ text: 'Account Settings' },
{ text: 'App Settings' },
],
cancelText: 'Cancel',
buttonClicked: function(index) {
$ionicSideMenuDelegate.toggleRight(); // Close the menu
if (index == 0) {
$location.path("/app/support");
} else if (index == 1) {
$location.path("/app/settings/account");
} else if (index == 2) {
$location.path("/app/settings/app")
}
return true;
}
});
};
})
As you see, I already figured out how to do the equivalent of menu-close
by using $ionicSideMenuDelegate
. But how can I do the equivalent of nav-clear
in the controller? In other words, when $location.path()
is called, rather than pushing onto the nav stack, I just want to load the view and reset the stack. I looked at the $ionicNavBarDelegate
but it didn’t appear to have any clear method.
Thanks in advance for any help!