Tab.hidden not fired

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

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

Sample : http://codepen.io/calendee/pen/blmDg

I’ve opened Issue # 813 : https://github.com/driftyco/ionic/issues/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 : http://codepen.io/calendee/pen/kaHGK/