fix(tabs): remove unselected tabs on clearCache

This commit is contained in:
Adam Bradley
2014-12-02 11:50:27 -06:00
parent 0a8eb3914f
commit 767362bebd
2 changed files with 20 additions and 5 deletions

View File

@@ -161,10 +161,15 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
self.clearCache = function() {
var viewElements = $element.children();
var viewElement, viewScope;
for (var x = 0, l = viewElements.length; x < l; x++) {
if (navViewAttr(viewElements.eq(x)) == VIEW_STATUS_CACHED) {
$ionicViewSwitcher.destroyViewEle(viewElements.eq(x));
viewElement = viewElements.eq(x);
if (navViewAttr(viewElement) == VIEW_STATUS_CACHED) {
$ionicViewSwitcher.destroyViewEle(viewElement);
} else if (navViewAttr(viewElement) == VIEW_STATUS_ACTIVE) {
viewScope = viewElement.scope();
viewScope && viewScope.$broadcast('$ionicView.clearCache');
}
}