mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
6
js/angular/controller/navViewController.js
vendored
6
js/angular/controller/navViewController.js
vendored
@@ -343,7 +343,9 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
|
||||
|
||||
backView = $ionicHistory.backView();
|
||||
|
||||
if (!backView || backView.historyId !== $ionicHistory.currentView().historyId) return;
|
||||
var currentView = $ionicHistory.currentView();
|
||||
|
||||
if (!backView || backView.historyId !== currentView.historyId || currentView.canSwipeBack === false) return;
|
||||
|
||||
if (!windowWidth) windowWidth = window.innerWidth;
|
||||
|
||||
@@ -360,7 +362,7 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
|
||||
showBackButton: self.showBackButton()
|
||||
};
|
||||
|
||||
var switcher = $ionicViewSwitcher.create(self, registerData, backView, $ionicHistory.currentView(), true, false);
|
||||
var switcher = $ionicViewSwitcher.create(self, registerData, backView, currentView, true, false);
|
||||
switcher.loadViewElements(registerData);
|
||||
switcher.render(registerData);
|
||||
|
||||
|
||||
3
js/angular/directive/view.js
vendored
3
js/angular/directive/view.js
vendored
@@ -97,6 +97,9 @@
|
||||
* @param {boolean=} cache-view If this view should be allowed to be cached or not.
|
||||
* Please see the _Caching_ section in {@link ionic.directive:ionNavView} for
|
||||
* more info. Default `true`
|
||||
* @param {boolean=} can-swipe-back If this view should be allowed to use the swipe to go back gesture or not.
|
||||
* This does not enable the swipe to go back feature if it is not available for the platform it's running
|
||||
* from, or there isn't a previous view. Default `true`
|
||||
* @param {boolean=} hide-back-button Whether to hide the back button on the parent
|
||||
* {@link ionic.directive:ionNavBar} by default.
|
||||
* @param {boolean=} hide-nav-bar Whether to hide the parent
|
||||
|
||||
13
js/angular/service/history.js
vendored
13
js/angular/service/history.js
vendored
@@ -359,7 +359,8 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
|
||||
stateId: currentStateId,
|
||||
stateName: this.currentStateName(),
|
||||
stateParams: getCurrentStateParams(),
|
||||
url: url
|
||||
url: url,
|
||||
canSwipeBack: canSwipeBack(ele, viewLocals)
|
||||
});
|
||||
|
||||
// add the new view to this history's stack
|
||||
@@ -717,6 +718,16 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
|
||||
return ele && ele.length && /ion-side-menus|ion-tabs/i.test(ele[0].tagName);
|
||||
}
|
||||
|
||||
function canSwipeBack(ele, viewLocals) {
|
||||
if (viewLocals && viewLocals.$$state && viewLocals.$$state.self.canSwipeBack === false) {
|
||||
return false;
|
||||
}
|
||||
if (ele && ele.attr('can-swipe-back') === 'false') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}])
|
||||
|
||||
.run([
|
||||
|
||||
Reference in New Issue
Block a user