Calling function in controller from on resume event in app.js


#1

My app is based on the tabs template. When the app comes to the foreground I want to force the data to be reloaded if it is stale. Since $ionicView.beforeEnter and $ionicView.enter don’t get called when app comes to the foreground, I’ve got the $ionicPlatform on resume event working fine in the .run of app.js.

I know which tab is selected, by using $ionicTabsDelegate.selectedIndex() but I now need to call the refresh function on the relevant tab’s controller and have no idea how to do that!

Using the tabs starter template, this would be equivalent of calling the ChatsCtrl remove function from $ionicPlatform.ready of app.js.


#2

Hi, just wanted to ask if you had solved this as i’m looking for something similar, to be able to call a function in a controller when a push arrives.