feat(menuClose): do not show next back button

When navigating to a view from a button/link with the `menuClose`
attribute directive, the back button should not show for the next view.
This commit is contained in:
Adam Bradley
2014-11-12 12:30:11 -06:00
parent baf98a132e
commit ba3eefdf8a
3 changed files with 50 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ IonicModule
// lower priority than navAnimation which allows navTransition
// to override this directive's nextTransition() call
$ionicViewSwitcher.nextTransition('none');
$ionicViewSwitcher.nextShowBack(false);
sideMenuCtrl.close();
}
});

View File

@@ -29,8 +29,7 @@ function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicCon
var VIEW_STATUS_STAGED = 'stage';
var transitionCounter = 0;
var nextTransition;
var nextDirection;
var nextTransition, nextDirection, nextShowBack;
ionic.transition = ionic.transition || {};
ionic.transition.isActive = false;
var isActiveTimer;
@@ -74,6 +73,7 @@ function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicCon
var transition = nextTransition || ionic.DomUtil.cachedAttr(enteringEle, 'view-transition') || state.viewTransition || $ionicConfig.views.transition() || 'none';
direction = nextDirection || ionic.DomUtil.cachedAttr(enteringEle, 'view-direction') || state.viewDirection || direction || 'none';
var shouldAnimate = (transition !== 'none' && direction !== 'none');
showBack = (nextShowBack === true || nextShowBack === false ? nextShowBack : !!showBack);
return {
transition: transition,
@@ -83,7 +83,7 @@ function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicCon
stateId: enteringView.stateId,
stateName: enteringView.stateName,
stateParams: enteringView.stateParams,
showBack: !!showBack
showBack: showBack
};
}
@@ -274,7 +274,7 @@ function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicCon
}
// remove any references that could cause memory issues
nextTransition = nextDirection = enteringView = enteringEle = leavingEle = null;
nextTransition = nextDirection = nextShowBack = enteringView = enteringEle = leavingEle = null;
}
},
@@ -383,6 +383,10 @@ function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicCon
nextDirection = val;
},
nextShowBack: function(val) {
nextShowBack = val;
},
getTransitionData: getTransitionData,
viewEleIsActive: function(viewEle, isActiveAttr) {