Ionic/UI router broadcast an event on state change

When i get back to inital state (home) from another page (es. settings), i need to re-call functions to reload data, and these call are handled with cordova events (resume, pause, online..), but on page change none of this events get invoked automaticly,

I thought of doing something like this on page settings:

.controller('gobackCtrl', ['$scope', '$rootScope', '$state',
function($scope, $rootScope, $state){

    $scope.goBack = function() {
      $state.go('app.home');
      $rootScope.$broadcast('app-resume', {});
    };

}]);

But since controllers are on different states they won't get invoked.

How could i solve this problem?

Where is your listener on the home state? I'd have a similar issue and I'm using this approach too. And it works well:

I have two states:

$stateProvider
    .state('players', {
        url         : '/players',
        controller  : 'PlayersCtrl as players',
        resolve     : {
            playersObj : function(
                $localForage,
                AppSettings
            ) {
                return $localForage.getItem(AppSettings.tables.players);
            }
        },
        templateUrl : 'players.html',
        title       : 'Players'
    })
    .state('players_detail', {
        url         : '/players/:playerId',
        controller  : 'PlayerCtrl as player',
        templateUrl : 'player.html',
        title       : 'Player'
    });

In my PlayersCtrl I must use a listener to the update event:

function PlayersCtrl(
    $rootScope,
    playersObj    // resolve
) {
    // ViewModel
    var vm = this;
    vm.users = playersObj;

    $rootScope.$on('player.update', function(evt, data) {
        vm.users = data;    // update data on details state
    });
}

And in my PlayerCtrl I trigger the update event:

function PlayerCtrl(
        $rootScope,
        $state
    ) {

    // ViewModel
    var vm = this;

    vm.player_update = function() {
        // some magic happens here ;)
        …

        // player updated successfully, use broadcast event to notify the PlayersCtrl
        $state.go('players');
        $rootScope.$broadcast('player.update', myUpdatedData);
    };

}

Without the broadcast event my players list never updated. With the event it works.

Ciao Ralf