Beta 14 - Cached view / Why $destroy event is not triggered in this case?


I know that cached views’s scopes aren’t destroyed, their scope are just reconnected.

However let’s suppose this scenario:
In a tab, their is 2 associated views whose ui-states are:
tabs.list and tabs.itemDetail. (tabs being the abstract parent state for both)
=> A classic list view and item view: a click on an item in the tabs.list screen leads to itemDetail.

Only tabs.itemDetail is declared with cached: false, since I only want to cache the view listing elements.

When I go back from itemDetail to list, I expect $scope.$on('$destroy') to be triggered since itemDetail is not cached; but it isn’t.
(The itemDetail's controller’s scope is well recreated each time as expected).

What is the reason ?



I am having the same problem where a view is marked as cache-view=“false” and each time it recreates the controller but the old controller is never destroyed ie. $scope.$on(’$destroy’) is never called

1 Like