Cached state controller instantiates on some state changes


I have a state with a controller, and I have cache: true set. Sometimes when I navigate to the state after the first time, the controller is being instantiated. Why? Shouldn’t the state be cached, and the controller only instantiated once?

Here is my config for the state:

.state('foo-state', {
		cache: true,
		url: '/foo-state',
		views: {
			'menuContent': {
				templateUrl: 'modules/foo/views/foo-state.html',
				controller: 'FooStateController'

I have been trying different ways of navigating to the state by clicking the browser back button, but using $state.go, and by manually typing the state into the address bar, and I’ve tried navigating starting from different states. I can’t find a consistent pattern. Any help would be awesome.


per default a controller and the connected template is only cached for one back-action to it.

If you go again to this view it is instantiated again.

You are going from View A to B and then to C --> now A, B are cachend
Now you are going back to B --> the cached B is used
In the next step you are going back to A --> the cached one is used

If you are going again to B or C they are reinstantiated.
Because per default “forward views” are not cached.

Another reasin could be that the default count of cached views is set to 10 --> if you reach the limit the oldest cached views are getting wiped and replaced by the new ones.

You can activate forwardCaching and increasing the view cache limit in the $ionicConfigProvider.$ionicConfigProvider/