mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(backButton): separate show/enable logic
Previously the showBack property was setting if the back button should or should not be enabled, and it was also used if the back button should be hidden or not for the view. Changed it so there are now two concepts, where showBack is visual only, and enableBack determines if it should show according to $ionicHistory and navigation info.
This commit is contained in:
12
js/angular/controller/navViewController.js
vendored
12
js/angular/controller/navViewController.js
vendored
@@ -89,7 +89,7 @@ function($scope, $element, $attrs, $ionicNavBarDelegate, $ionicHistory, $ionicVi
|
||||
// the view is now compiled, in the dom and linked, now lets transition the views.
|
||||
// this uses a callback incase THIS nav-view has a nested nav-view, and after the NESTED
|
||||
// nav-view links, the NESTED nav-view would update which direction THIS nav-view should use
|
||||
switcher.transition(self.direction(), registerData.showBack);
|
||||
switcher.transition(self.direction(), registerData.enableBack);
|
||||
});
|
||||
|
||||
};
|
||||
@@ -111,9 +111,15 @@ function($scope, $element, $attrs, $ionicNavBarDelegate, $ionicHistory, $ionicVi
|
||||
};
|
||||
|
||||
|
||||
self.showBackButton = function(val) {
|
||||
self.enableBackButton = function(shouldEnable) {
|
||||
var associatedNavBarCtrl = getAssociatedNavBarCtrl();
|
||||
associatedNavBarCtrl && associatedNavBarCtrl.showBackButton(val);
|
||||
associatedNavBarCtrl && associatedNavBarCtrl.enableBackButton(shouldEnable);
|
||||
};
|
||||
|
||||
|
||||
self.showBackButton = function(shouldShow) {
|
||||
var associatedNavBarCtrl = getAssociatedNavBarCtrl();
|
||||
associatedNavBarCtrl && associatedNavBarCtrl.showBackButton(shouldShow);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user