fix(tabs): slide box within modal within tabs

This commit is contained in:
Adam Bradley
2014-12-05 11:40:00 -06:00
parent 3bcda3f2f1
commit c86962fbfb
3 changed files with 30 additions and 10 deletions

View File

@@ -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)();

View File

@@ -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;

View File

@@ -77,3 +77,15 @@ ion-slide {
}
}
}
.modal {
.slider {
position: absolute;
width: 100%;
height: 100%;
}
.slider-slides, .slider-slide {
height: 100%;
}
}