mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(menuClose): expire nextViewOptions
This commit is contained in:
3
js/angular/directive/menuClose.js
vendored
3
js/angular/directive/menuClose.js
vendored
@@ -33,7 +33,8 @@ IonicModule
|
||||
if (sideMenuCtrl) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
historyRoot: true,
|
||||
disableAnimate: true
|
||||
disableAnimate: true,
|
||||
expire: 300
|
||||
});
|
||||
sideMenuCtrl.close();
|
||||
}
|
||||
|
||||
12
js/angular/service/history.js
vendored
12
js/angular/service/history.js
vendored
@@ -21,9 +21,10 @@ IonicModule
|
||||
'$state',
|
||||
'$location',
|
||||
'$window',
|
||||
'$timeout',
|
||||
'$ionicViewSwitcher',
|
||||
'$ionicNavViewDelegate',
|
||||
function($rootScope, $state, $location, $window, $ionicViewSwitcher, $ionicNavViewDelegate) {
|
||||
function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $ionicNavViewDelegate) {
|
||||
|
||||
// history actions while navigating views
|
||||
var ACTION_INITIAL_VIEW = 'initialView';
|
||||
@@ -40,7 +41,7 @@ function($rootScope, $state, $location, $window, $ionicViewSwitcher, $ionicNavVi
|
||||
var DIRECTION_NONE = 'none';
|
||||
|
||||
var stateChangeCounter = 0;
|
||||
var lastStateId, nextViewOptions, forcedNav;
|
||||
var lastStateId, nextViewOptions, nextViewExpireTimer, forcedNav;
|
||||
|
||||
var viewHistory = {
|
||||
histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },
|
||||
@@ -364,6 +365,7 @@ function($rootScope, $state, $location, $window, $ionicViewSwitcher, $ionicNavVi
|
||||
hist.stack.push(viewHistory.views[viewId]);
|
||||
}
|
||||
|
||||
$timeout.cancel(nextViewExpireTimer);
|
||||
if (nextViewOptions) {
|
||||
if (nextViewOptions.disableAnimate) direction = DIRECTION_NONE;
|
||||
if (nextViewOptions.disableBack) viewHistory.views[viewId].backViewId = null;
|
||||
@@ -627,11 +629,17 @@ function($rootScope, $state, $location, $window, $ionicViewSwitcher, $ionicNavVi
|
||||
*/
|
||||
nextViewOptions: function(opts) {
|
||||
if (arguments.length) {
|
||||
$timeout.cancel(nextViewExpireTimer);
|
||||
if (opts === null) {
|
||||
nextViewOptions = opts;
|
||||
} else {
|
||||
nextViewOptions = nextViewOptions || {};
|
||||
extend(nextViewOptions, opts);
|
||||
if (nextViewOptions.expire) {
|
||||
nextViewExpireTimer = $timeout(function(){
|
||||
nextViewOptions = null;
|
||||
}, nextViewOptions.expire);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nextViewOptions;
|
||||
|
||||
Reference in New Issue
Block a user