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

Commit

Permalink
fix(tabs): Tab pagination/selection now works properly on iOS
Browse files Browse the repository at this point in the history
Closes #220
Closes #231
  • Loading branch information
ThomasBurleson committed Sep 10, 2014
1 parent a0f5f66 commit 3410650
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/tabs/js/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function linkTabPagination(scope, element, tabsCtrl, $q, $materialEffects ) {
// before we announce status [and potentially update focus]

if ( pageChange ) {

tabsHeader.one($materialEffects.TRANSITIONEND_EVENT, function() {
dfd.resolve(pageIndex);
});
Expand Down Expand Up @@ -107,22 +108,14 @@ function linkTabPagination(scope, element, tabsCtrl, $q, $materialEffects ) {
if ( page < 0 ) page = 0;
if ( page > lastPage ) page = lastPage;

pagination.page = page;

pagination.startIndex = !pagination.active ? 0 : page * pagination.itemsPerPage;
pagination.endIndex = !pagination.active ? lastTab : pagination.startIndex + pagination.itemsPerPage - 1;
pagination.hasPrev = !pagination.active ? false : page > 0;
pagination.hasNext = !pagination.active ? false : (page + 1) < pagination.pagesCount;

slideTabButtons( -page * pagination.itemsPerPage * pagination.tabWidth );

if ( (updateTabSelection !== false) && !isTabInRange(scope.$selIndex) ) {
var index = (page > pagination.page) ? pagination.startIndex : pagination.endIndex;

// Only change selected tab IF the current tab is not `in range`
tabsCtrl.selectAt( index );
}

pagination.page = page;

}

/**
Expand Down

0 comments on commit 3410650

Please sign in to comment.