$ionicView.enter or cache:false

I’m developing a view that need call multiples methods of a webservice every time the view is opened, should i use $scope.$on(’$ionicView.enter’, function(){…}) or cache:false ? What is the real difference between each one ?

Cheers, Felipe

if viewCaching is active and your view is cached the controller is not executed again. Cached means:

  1. you open the view the first time
  • controller gets executed
  • template gets rendered
  1. you leave the view
  • template is disconnected from the current scope
  • controller and template are cached
  1. you enter a cached view
  • controller and template are restored from cache --> everything is as you leave the view
  • template gets connected to the scope
  • only some ionicView events are triggered to have the chance to handle stuff that should be done everytime you enter or leave the view

If you are not caching the view your controller will be executed again everytime.

Hi bentler, your answer isn’t exactly what i was looking for, but it still useful, thanks.

I asked this same question in StackOverflow and i got really nice answers

oh okay sorry then i did not understand you correctly.