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

Commit 4a16038

Browse files
author
Robert Messerle
committed
fix(tabs): addresses potential $digest already in progress error
Closes #4743
1 parent 1a0fc6b commit 4a16038

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/components/tabs/js/tabsController.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
249249
handleResizeWhenVisible.watcher();
250250
handleResizeWhenVisible.watcher = null;
251251

252-
// we have to trigger our own $apply so that the DOM bindings will update
253252
handleWindowResize();
254253
}
255254
}, false);
@@ -335,11 +334,11 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
335334
* Update size calculations when the window is resized.
336335
*/
337336
function handleWindowResize () {
338-
$scope.$apply(function () {
339-
ctrl.lastSelectedIndex = ctrl.selectedIndex;
340-
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
341-
$mdUtil.nextTick(ctrl.updateInkBarStyles, false);
342-
$mdUtil.nextTick(updatePagination);
337+
ctrl.lastSelectedIndex = ctrl.selectedIndex;
338+
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
339+
$mdUtil.nextTick(function () {
340+
ctrl.updateInkBarStyles();
341+
updatePagination();
343342
});
344343
}
345344

@@ -487,7 +486,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
487486
*/
488487
function shouldPaginate () {
489488
if (ctrl.noPagination || !loaded) return false;
490-
var canvasWidth = Math.min($element.prop('clientWidth'), ctrl.maxTabWidth);
489+
var canvasWidth = $element.prop('clientWidth');
491490
angular.forEach(elements.dummies, function (tab) { canvasWidth -= tab.offsetWidth; });
492491
return canvasWidth < 0;
493492
}
@@ -590,7 +589,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
590589
var tab = elements.tabs[ index ],
591590
left = tab.offsetLeft,
592591
right = tab.offsetWidth + left;
593-
ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(right - elements.canvas.clientWidth));
592+
ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(right - elements.canvas.clientWidth + 32 * 2));
594593
ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(left));
595594
}
596595

0 commit comments

Comments
 (0)