We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 801a6c0 commit 4d77f39Copy full SHA for 4d77f39
src/tabs/tabs.js
@@ -37,14 +37,19 @@ angular.module('ui.bootstrap.tabs', [])
37
38
ctrl.removeTab = function removeTab(tab) {
39
var index = tabs.indexOf(tab);
40
- //Select a new tab if the tab to be removed is selected
41
- if (tab.active && tabs.length > 1) {
+ //Select a new tab if the tab to be removed is selected and not destroyed
+ if (tab.active && tabs.length > 1 && !destroyed) {
42
//If this is the last tab, select the previous tab. else, the next tab.
43
var newActiveIndex = index == tabs.length - 1 ? index - 1 : index + 1;
44
ctrl.select(tabs[newActiveIndex]);
45
}
46
tabs.splice(index, 1);
47
};
48
+
49
+ var destroyed;
50
+ $scope.$on('$destroy', function() {
51
+ destroyed = true;
52
+ });
53
}])
54
55
/**
0 commit comments