Tab.hidden not fired


Refer to codepen ‘Ionic Sign-in, then Tabs’ example ,
the tab.hidden event is not fired if I add the following code in HomeTabCtrl.

.controller(‘HomeTabCtrl’, function($scope) {

$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’);

Actually, it does fire. However, it only fires one time. Thanks for pointing this out!

Sample :

I’ve opened Issue # 813 :

So those events were actually removed in all future versions. You might want to see the alternative options here:

I have tried $scope.on(’$destroy’), and it works well.

What is the alternative option for ‘tab.shown’?

“Instead, use on-select and on-deselect attribute callbacks.”

See this sample :