mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(ionTabBar): remove tab.shown and tab.hidden events
Instead, use `on-select` and `on-deselect` attribute callbacks.
Alternatively, listen for $scope.$on('$destroy') in a controller inside
your tab.
This commit is contained in:
6
js/ext/angular/src/directive/ionicTabBar.js
vendored
6
js/ext/angular/src/directive/ionicTabBar.js
vendored
@@ -218,8 +218,6 @@ function($scope, $ionicViewService, $rootScope, $element) {
|
||||
*
|
||||
* Each ionTab has its own view history.
|
||||
*
|
||||
* Whenever a tab is shown or hidden, it will broadcast a 'tab.shown' or 'tab.hidden' event.
|
||||
*
|
||||
* @usage
|
||||
* ```html
|
||||
* <ion-tab
|
||||
@@ -308,9 +306,6 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) {
|
||||
tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));
|
||||
|
||||
$scope.$watch('$tabSelected', function(value) {
|
||||
if (!value) {
|
||||
$scope.$broadcast('tab.hidden', $scope);
|
||||
}
|
||||
childScope && childScope.$destroy();
|
||||
childScope = null;
|
||||
childElement && $animate.leave(childElement);
|
||||
@@ -320,7 +315,6 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) {
|
||||
childElement = tabContent.clone();
|
||||
$animate.enter(childElement, tabsCtrl.$element);
|
||||
$compile(childElement)(childScope);
|
||||
$scope.$broadcast('tab.shown', $scope);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user