Reload the routes on app resume


#1

Hello,

I load the states (routes) remotely. They are loaded correctly when the app loads for the 1st time but I’d like to reload them when the app resumes (on IOS, the user clicks the home button and relaunches the app)

$ionicPlatform.on('resume', function() {
   // Reload the routes
});

Unfortunately, I can’t do this inside “on resume”:

$state.state('test123', {
  id: 'test123',
  url: '/test123',
  templateUrl: '/test123.html',
  controller: 'Test123Ctrl'
});

Thanks for your help


#2

You can try to set the cache to false.

eg:

$state.state('test123', {
  id: 'test123',
  url: '/test123',
  cache: false
  templateUrl: '/test123.html',
  controller: 'Test123Ctrl'
});

#3

I don’t think I explained my issue correctly.
I want to refresh the routes but I also want to add new ones. The code that I posted is supposed to be a brand new route. How can I add it on resume?
Thanks


#4

Any idea, anyone???
Is there any solution to add/remove routes on app resume?
Thanks