$ionicHistory and caching pages

If I have all my views cached in the default way, how can I force a refresh of the data in scope variables every time a view is entered?

Or is the whole point that you would disable caching in that situation?

You should use this event:
$scope.$on('$ionicView.beforeEnter', function(){ updateMyScopeVariables(); });

This event is triggered every time you access the cached view.

And in updateVariables() do I need to manually call every update that I want?

Is there not something built in that refreshes all variables?

I tried $scope.$on(’$ionicView.enter’, function(){ $scope.$apply(); }) and thought that would work but it didnt

updateMyScopeVariables() would typically operate an ajax request in order to refresh the list, like a pull-to-refresh would do.

I’m very confused by this.

An example in my controller is $scope.activeUser = accountService.users.get.activeUser() which works fine on first loads.

Then I would have thought $scope.$on('$ionicView.beforeEnter', function(){ $scope.activeUser = accountService.users.get.activeUser(); }) would work, no?

Yes it should work completely.


I wrapped the whole contents of my controller in $scope.$on('$ionicView.beforeEnter', function(){ })

the $scope variables are updated in the code, however they dont seem to have bound to the page?

Also, I have a directive inside the view which is not being updated because of the caching