Tab scope function called a lot when navigating other tabs


#1

My setup:

iojs v2.3.4
ionic 1.6.5
cordova 5.3.3

I ran ionic start test tabs and then went into the test dir. I edited the following files:
www/js/controllers.js - added a getChatName to ChatsCtrl

$scope.getChatName = function(chat) {
    console.log("getting name..");
    return chat.name;
};

www/templates/tab-chats.html - replaced the {{ chat.name }} with {{ getChatName(chat) }}

Now I run ionic serve

In the browser, when I navigate to the chats tab, I see the console output quite a bit. That’s expected due to angular being angular. But when I navigate between other tabs (Status and Account), I see those prints also emitted. That seems pretty wasteful to me.

What is the cause of this and is this fixable? I wouldn’t expect this behavior.

Update - this is most definitely related to view caching. Setting $ionicConfigProvider.views.maxCache(0) will reduce the prints. So it seems the DOM is cached but also “active”