According to the official doc, ion-view will emit its life-cycle events to help us control its logic.
But how can I catch these events?
You can attach the events with the $scope
in the relevant controller.
angular.module('ionicApp', ['ionic'])
.controller('HomeTabCtrl', function($scope) {
$scope.$on('$ionicView.loaded', function (viewInfo, state) {
console.log('CTRL - $ionicView.loaded', viewInfo, state);
});
$scope.$on('$ionicView.unloaded', function (viewInfo, state) {
console.log('CTRL - $ionicView.unloaded', viewInfo, state);
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With