Ion view events called everytime!

I got two controllers ‘ActivityCtrl’ and “FriendsCtrl”, both rendered on root ion-nav-view (index.html)

.state('activity', {
  url: '/activity/:activity_key',
  views: {
    '@': {
      templateUrl: 'templates/activity.html',
      controller: 'ActivityCtrl'
    }
  }
})

.state('friends', {
  url: '/friends/:activity_key',
  views: {
    '@': {
      templateUrl: 'templates/friends.html',
      controller: 'FriendCtrl'
    }
  }
})

I put a debug points on each controller:

$rootScope.$on('$ionicView.loaded', function() {
	console.log('ctrl loaded, must go to cache');
});	

$rootScope.$on('$ionicView.enter', function() {
	console.log('ctrl entered, must be retrieved from cache');
});

When I fisrt navigate to ActivityCtrl got this on console:

ActivityCtrl loaded, must go to cache
ActivityCtrl entered, must be retrieved from cache

An then navigate to FriendCtrl and got more 4 lines on debug console:

ActivityCtrl loaded, must go to cache
FriendCtrl loaded, must go to cache
ActivityCtrl entered, must be retrieved from cache
FriendCtrl entered, must be retrieved from cache

Why the loaded event is called again to ActivityCtrl ? I´m leaving it !

And if I´m came back to FriendCtrl and then go to it again the loaded event from FriendCtrl is fired again, so it´s not cached.

Is this a strage behavior or not ?

I expect that when I go to a view the second time it should be on cache and just the enter event fired.

Can you guys help me ?

I’m not an expert on this but why are you using $rootScope? I think what you want to use is $scope. See this codepen: http://codepen.io/anon/pen/JoEMxw

Also, try to put your code in a code block on the forum using this icon </>. It makes it easier to read. :smile: