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

Commit

Permalink
fix(tabs): don't paginate on initial load when width is 0
Browse files Browse the repository at this point in the history
Closes #271
  • Loading branch information
ajoslin committed Sep 16, 2014
1 parent 0cca322 commit 5f5435d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/tabs/js/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ function linkTabPagination(scope, element, tabsCtrl, $q, $materialEffects ) {
*/
function updatePagination() {
var dfd = $q.defer();

var tabs = buttonBar.children();
var tabsWidth = element.prop('clientWidth') - PAGINATORS_WIDTH;

var needPagination = (tabsWidth > 0) && ((TAB_MIN_WIDTH * tabs.length) > tabsWidth);
var paginationToggled = (needPagination !== pagination.active);

if (tabsWidth <= 0) {
//tabsWidth is 0 on initial load. Just instantly resolve the promise if it's 0
return $q.when();
}

pagination.active = needPagination;

if (needPagination) {
Expand Down

0 comments on commit 5f5435d

Please sign in to comment.