mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(tabs): slide box within modal within tabs
This commit is contained in:
26
js/angular/controller/tabsController.js
vendored
26
js/angular/controller/tabsController.js
vendored
@@ -1,18 +1,19 @@
|
||||
IonicModule
|
||||
.controller('$ionicTabs', [
|
||||
'$scope',
|
||||
'$ionicHistory',
|
||||
'$element',
|
||||
function($scope, $ionicHistory, $element) {
|
||||
var _selectedTab = null;
|
||||
'$ionicHistory',
|
||||
function($scope, $element, $ionicHistory) {
|
||||
var self = this;
|
||||
var selectedTab = null;
|
||||
var selectedTabIndex;
|
||||
self.tabs = [];
|
||||
|
||||
self.selectedIndex = function() {
|
||||
return self.tabs.indexOf(_selectedTab);
|
||||
return self.tabs.indexOf(selectedTab);
|
||||
};
|
||||
self.selectedTab = function() {
|
||||
return _selectedTab;
|
||||
return selectedTab;
|
||||
};
|
||||
|
||||
self.add = function(tab) {
|
||||
@@ -42,7 +43,7 @@ function($scope, $ionicHistory, $element) {
|
||||
|
||||
self.deselect = function(tab) {
|
||||
if (tab.$tabSelected) {
|
||||
_selectedTab = null;
|
||||
selectedTab = selectedTabIndex = null;
|
||||
tab.$tabSelected = false;
|
||||
(tab.onDeselect || angular.noop)();
|
||||
tab.$broadcast && tab.$broadcast('$ionicHistory.deselect');
|
||||
@@ -63,16 +64,23 @@ function($scope, $ionicHistory, $element) {
|
||||
shouldEmitEvent = !!(tab.navViewName || tab.uiSref);
|
||||
}
|
||||
|
||||
if (_selectedTab && _selectedTab.$historyId == tab.$historyId) {
|
||||
if (selectedTab && selectedTab.$historyId == tab.$historyId) {
|
||||
if (shouldEmitEvent) {
|
||||
$ionicHistory.goToHistoryRoot(tab.$historyId);
|
||||
}
|
||||
} else {
|
||||
|
||||
} else if (selectedTabIndex !== tabIndex) {
|
||||
forEach(self.tabs, function(tab) {
|
||||
self.deselect(tab);
|
||||
});
|
||||
|
||||
_selectedTab = tab;
|
||||
selectedTab = tab;
|
||||
selectedTabIndex = tabIndex;
|
||||
|
||||
if (self.$scope && self.$scope.$parent) {
|
||||
self.$scope.$parent.$activeHistoryId = tab.$historyId;
|
||||
}
|
||||
|
||||
//Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope
|
||||
tab.$tabSelected = true;
|
||||
(tab.onSelect || angular.noop)();
|
||||
|
||||
2
js/angular/service/history.js
vendored
2
js/angular/service/history.js
vendored
@@ -664,7 +664,7 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
|
||||
if (climbScope.$$disconnected) {
|
||||
return false;
|
||||
}
|
||||
if (currentHistoryId && currentHistoryId == climbScope.$historyId) {
|
||||
if (currentHistoryId && (currentHistoryId == climbScope.$historyId || currentHistoryId == climbScope.$activeHistoryId)) {
|
||||
return true;
|
||||
}
|
||||
climbScope = climbScope.$parent;
|
||||
|
||||
@@ -77,3 +77,15 @@ ion-slide {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal {
|
||||
.slider {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.slider-slides, .slider-slide {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user