Refresh controller list on app resume

Hi there,

I’ve go a question corresponding app “resume” event. I want to refresh a list in my controller (list of items listed in frontend) on app resume. What i have in my controller is:

  $scope.loadList = function() {
        var promise = ListItems.all();
        promise.then(
            function (payload) {
                $scope.listItems = payload;
                $scope.selectedItem = $scope.listItems[0];
            },
            function (errorPayload) {
                $log.error('failure loading items', errorPayload);
            });
    }

    $ionicPlatform.on('resume', function(){
        $scope.loadItems();
    });

But somehow it does not work.

Any idea what I’m doing wrong or how I could archive this?

Cheers

I wasn’t aware of $ionic.Platform.on(‘resume’ …
But if it workshop you should call an existing function. Maybe you should call $scope.loadList(), not $scope.loadItems()

I checked $ionic.Platform events. You are right? Resume is a valid event and should work. Do, check the name of the function you are calling.

I just tried doing something similar to this in my app and it seems to work just fine.