Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 31bb121

Browse files
author
Robert Messerle
committed
fix(tabs): prevents error when navigating away from tabs section while using Angular 1.4.x
1 parent 7bbfd1f commit 31bb121

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/tabs/js/tabsController.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,13 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
348348
* @param tabData
349349
*/
350350
function removeTab (tabData) {
351+
if (destroyed) return;
351352
var selectedIndex = ctrl.selectedIndex,
352353
tab = ctrl.tabs.splice(tabData.getIndex(), 1)[ 0 ];
353354
refreshIndex();
354355
// when removing a tab, if the selected index did not change, we have to manually trigger the
355356
// tab select/deselect events
356-
if (ctrl.selectedIndex === selectedIndex && !destroyed) {
357+
if (ctrl.selectedIndex === selectedIndex) {
357358
tab.scope.deselect();
358359
ctrl.tabs[ ctrl.selectedIndex ] && ctrl.tabs[ ctrl.selectedIndex ].scope.select();
359360
}

0 commit comments

Comments
 (0)