mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix($ionicTabsDelegate): find active tab instance
This commit is contained in:
15
js/angular/controller/tabsController.js
vendored
15
js/angular/controller/tabsController.js
vendored
@@ -77,7 +77,7 @@ function($scope, $ionicHistory, $element) {
|
||||
(tab.onSelect || angular.noop)();
|
||||
|
||||
if (shouldEmitEvent) {
|
||||
var viewData = {
|
||||
$scope.$emit('$ionicHistory.change', {
|
||||
type: 'tab',
|
||||
tabIndex: tabIndex,
|
||||
historyId: tab.$historyId,
|
||||
@@ -86,9 +86,18 @@ function($scope, $ionicHistory, $element) {
|
||||
title: tab.title,
|
||||
url: tab.href,
|
||||
uiSref: tab.uiSref
|
||||
};
|
||||
$scope.$emit('$ionicHistory.change', viewData);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.hasActiveScope = function() {
|
||||
for (var x = 0; x < self.tabs.length; x++) {
|
||||
if ($ionicHistory.isActiveScope(self.tabs[x])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
4
js/angular/directive/tabs.js
vendored
4
js/angular/directive/tabs.js
vendored
@@ -66,9 +66,7 @@ function($ionicTabsDelegate, $ionicConfig, $ionicHistory) {
|
||||
return { pre: prelink, post: postLink };
|
||||
function prelink($scope, $element, $attr, tabsCtrl) {
|
||||
var deregisterInstance = $ionicTabsDelegate._registerInstance(
|
||||
tabsCtrl, $attr.delegateHandle, function() {
|
||||
return $ionicHistory.isActiveScope($scope);
|
||||
}
|
||||
tabsCtrl, $attr.delegateHandle, tabsCtrl.hasActiveScope
|
||||
);
|
||||
|
||||
tabsCtrl.$scope = $scope;
|
||||
|
||||
Reference in New Issue
Block a user