How to run a function , after reopening the app

I am using ionic framework. here is my app.js

.state('app.articlelist,{
   cache:false,
   url:"",
and so on..
)

and controller file

.controller('ArticleCtrl',function($scope,getArticle){
  alert("Controller runs");
    getArticle.getAriclefromDb().then(function(res){
      alert("hello test");
   });
});

Which is working fine .

Now i have closed my app and also its background process. Now when i reopen mu app agan

i am able to see alert(“controller runs”). but not hello test . this is working fine first time

any suggestions for the same

You have to use the resume event: http://docs.phonegap.com/en/4.0.0/cordova_events_events.md.html#resume
Basically, you would broadcast within it to any controllers listening to this event.

1 Like

@Mik378 thanks for your reply. Could you please provide sample code for broadcasting. So i can run my factory code. Also will resume event will work after closing app fully from background too