tab.shown
and tab.hidden
have been killed. Although tab.shown
is still working in some code bases and tab.hidden
works one time only in some code bases.
Hi,
Refer to codepen ‘Ionic Sign-in, then Tabs’ example http://codepen.io/ionic/pen/kcjLb ,
the tab.hidden event is not fired if I add the following code in HomeTabCtrl.
.controller(‘HomeTabCtrl’, function($scope) {
console.log(‘HomeTabCtrl’);
$scope.$on(‘tab.shown’, function() {
// Maybe load some content here
console.log(‘Home tab.shown’);
});
$scope.$on(‘tab.hidden’, function() {
// Perhaps cycle out some data in memory here
console.log(‘Home tab.hidden’);
});
});
opened 03:48PM - 17 Mar 14 UTC
closed 08:43PM - 17 Mar 14 UTC
`tab.hidden` only fires once. `tab.shown` fires every time.
Forum # 1926 : htt… p://forum.ionicframework.com/t/tab-hidden-not-fired/1926
CodePen Sample : http://codepen.io/calendee/pen/blmDg
See this old issue : https://github.com/driftyco/ionic/issues/415
committed 08:41PM - 17 Mar 14 UTC
Instead, use `on-select` and `on-deselect` attribute callbacks.
Alternatively, … listen for $scope.$on('$destroy') in a controller inside
your tab.