我想从离线导航窗格中删除后退按钮。
我尝试使用hide-back-button
,$ionicHistory
,$ionicHandleDelegate
,但它确实不符合我的目的。我只是不想使用“返回”导航到上一页,因为菜单按钮用于此目的。
我的HTML就像这样
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-stable">
<h1 class="title">Left</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item menu-close href="#/app/home">
Home
</ion-item>
<div ng-repeat = "opt in menuOptions">
<ion-item ng-click = "toggleOptions(opt)">
{{opt.name}}
</ion-item>
<ion-item menu-close ng-repeat = "item in opt.items" ng-show = "opt.show" ng-click = "toggleSubOptions(item)">
{{item.itemName}}
</ion-item>
</div>
<ion-item menu-close href="#" ui-sref="app.resetpass">
Reset Password
</ion-item>
<ion-item menu-close href="#" ng-click="logout()">
Logout
</ion-item>
</ion-list>
</ion-content>
我的控制器就是这样
serveApp.controller('AppCtrl', ['$scope','$state','$auth',function($scope,$state,$auth) {
console.log("App Ctrl");
$scope.menuOptions = [{
{
name : 'Opt2',
show : false,
items : [],
goTo: "app.page2"
},
{
name : 'Opt2',
show : false,
items : [],
goTo: "app.page2"
}
];
$scope.toggleOptions = function (option){
if(option.items.length != 0){
//console.log("suboption",option)
option.show = !option.show;
} else {
//console.log("no sub")
$state.go(option.goTo);
}
};