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

Commit 5f5435d

Browse files
committed
fix(tabs): don't paginate on initial load when width is 0
Closes #271
1 parent 0cca322 commit 5f5435d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/components/tabs/js/pagination.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ function linkTabPagination(scope, element, tabsCtrl, $q, $materialEffects ) {
4040
*/
4141
function updatePagination() {
4242
var dfd = $q.defer();
43-
4443
var tabs = buttonBar.children();
4544
var tabsWidth = element.prop('clientWidth') - PAGINATORS_WIDTH;
45+
4646
var needPagination = (tabsWidth > 0) && ((TAB_MIN_WIDTH * tabs.length) > tabsWidth);
4747
var paginationToggled = (needPagination !== pagination.active);
4848

49+
if (tabsWidth <= 0) {
50+
//tabsWidth is 0 on initial load. Just instantly resolve the promise if it's 0
51+
return $q.when();
52+
}
53+
4954
pagination.active = needPagination;
5055

5156
if (needPagination) {

0 commit comments

Comments
 (0)