$scope not disconnecting for ion-tab main controller


#1

Having some $watcher-leak problems in my current app, I tried to switch to a fully-cached application (till now there was a maxCache(0) set).

Apart from the rewrite needed to keep all the views updated, I’ve seen some problem with the detached $scopes when going away from a view that contains the main tags: $scope is NOT detached.

I’ve been debugging with Batarang, and while for every other “normal” controller I see that scope is actually “disappearing” upon exiting and “reappearing” upon entering the view, for the tab controllers this is not happening.

I’ll post the routing configuration of the incriminated view, probably I’m doing something the wrong way :slight_smile:

  .state('app.nonTabbedPage', {
    url: '/nonTabbed/:param1',
    templateUrl: 'app/nonTabbed/normalView.html',
    controller: 'NormalCtrl'
  })
  .state('app.tabs', {
    url: '/tab1',
    templateUrl: 'app/tabs/tabsView.html',
    controller: 'TabCtrl',
    abstract: true
  })
  .state('app.tabs.page1', {
    url: '/page1',
    views: {
      'tab-page1': { templateUrl: 'app/tabs/pages/page1View.html' }
    }
  })
  .state('app.tabs.page2', {
    url: '/page2',
    views: {
      'tab-page2': { templateUrl: 'app/tabs/pages/page2View.html' }
    }
  })
  .state('app.tabs.page3', {
    url: '/page3',
    views: {
      'tab-page3': { 
         templateUrl: 'app/tabs/pages/page3View.html',
         controller: 'Page3Ctrl'
      }
    }
  })

#2

Adding on the subject, I also noticed that the $ionicView.leave event is not fired when going from a “normal” controller to a “tabbed” one.

I’ve appurated that the problem might be in the fact that the parent tab controller (in the example before the TabCtrl) is set as abstract:
in fact, if I navigate from NormalCtrl to TabCtrl itself the $ionicView.leave is fired.
Instead, navigating from NormalCtrl to, let’s say, /page1 directly no event fires.


#3

Hi, did you find a way around this?